summaryrefslogtreecommitdiff
path: root/Postman
diff options
context:
space:
mode:
Diffstat (limited to 'Postman')
-rw-r--r--Postman/Postman-Controller/PostmanWelcomeController.php219
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogController.php20
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogService.php10
-rw-r--r--Postman/Postman-Email-Log/PostmanEmailLogView.php16
-rw-r--r--Postman/Postman-Mail/PostmanMessage.php4
-rw-r--r--Postman/Postman-Mail/PostmanTransportRegistry.php191
-rw-r--r--Postman/Postman.php2
-rw-r--r--Postman/PostmanInstaller.php201
-rw-r--r--Postman/PostmanPluginFeedback.php8
-rw-r--r--Postman/PostmanViewController.php31
10 files changed, 490 insertions, 212 deletions
diff --git a/Postman/Postman-Controller/PostmanWelcomeController.php b/Postman/Postman-Controller/PostmanWelcomeController.php
new file mode 100644
index 0000000..b43e969
--- /dev/null
+++ b/Postman/Postman-Controller/PostmanWelcomeController.php
@@ -0,0 +1,219 @@
+<?php
+
+class PostmanWelcomeController {
+
+ private $rootPluginFilenameAndPath, $pluginUrl, $version;
+
+ public function __construct( $rootPluginFilenameAndPath ) {
+ $this->rootPluginFilenameAndPath = $rootPluginFilenameAndPath;
+ $this->pluginUrl = plugins_url( 'style', $rootPluginFilenameAndPath );
+ $this->version = PostmanState::getInstance()->getVersion();
+
+ add_action( 'admin_menu', array( $this, 'add_menus' ) );
+ add_action( 'admin_head', array( $this, 'admin_head' ) );
+ }
+
+ public function add_menus() {
+
+ if ( current_user_can( 'manage_options' ) ) {
+
+ // About
+ add_dashboard_page(
+ __( 'Welcome', Postman::TEXT_DOMAIN ),
+ __( 'Welcome', Postman::TEXT_DOMAIN ),
+ 'manage_options',
+ 'post-about',
+ array( $this, 'about_screen' )
+ );
+
+ // Credits
+ add_dashboard_page(
+ __( 'Credits', Postman::TEXT_DOMAIN ),
+ __( 'Credits', Postman::TEXT_DOMAIN ),
+ 'manage_options',
+ 'post-credits',
+ array( $this, 'credits_screen' )
+ );
+
+ // add_action( 'admin_print_styles-' . $page, array( $this, 'postman_about_enqueue_resources' ) );
+ }
+ }
+
+ public function admin_head() {
+ remove_submenu_page( 'index.php', 'post-about' );
+ remove_submenu_page( 'index.php', 'post-credits' );
+ }
+
+ public function postman_about_enqueue_resources() {
+ // wp_enqueue_style( 'font-awsome', '' );
+ }
+
+
+ public function about_screen() {
+ ?>
+ <style type="text/css">
+ .post-badge {
+ position: absolute;
+ top: 0;
+ right: 0;
+ padding-top: 142px;
+ height: 50px;
+ width: 140px;
+ color: #000;
+ font-weight: bold;
+ font-size: 14px;
+ text-align: center;
+ margin: 0 -5px;
+ background: url( <?php echo $this->pluginUrl; ?>/images/badge.png) no-repeat;
+ }
+
+ .about-wrap [class$="-col"] {
+ flex-wrap: nowrap !important;
+ }
+ </style>
+ <div class="wrap about-wrap">
+ <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', Postman::TEXT_DOMAIN ), $this->version ); ?></h1>
+ <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! Post SMTP %s is bundled up and ready to take your SMTP needs to the next level!', Postman::TEXT_DOMAIN ), $this->version ); ?><br>
+ <?php printf( '<strong>%s</strong>','Post SMTP support every SMTP service: Gmail/G-suite, SendGrid, Mandrill, Office365, and more...' ); ?>
+ </div>
+ <div class="post-badge"><?php printf( esc_html__( 'Version %s', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
+
+ <h2 class="nav-tab-wrapper">
+ <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>">
+ <?php esc_html_e( 'What&#8217;s New', Postman::TEXT_DOMAIN ); ?>
+ </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>">
+ <?php esc_html_e( 'Credits', Postman::TEXT_DOMAIN ); ?>
+ </a>
+ </h2>
+
+ <div class="changelog">
+ <h3><?php esc_html_e( 'Email Log', Postman::TEXT_DOMAIN ); ?></h3>
+
+ <div class="feature-section col two-col">
+ <div class="last-feature">
+ <h4><?php esc_html_e( 'Email log filter', Postman::TEXT_DOMAIN ); ?></h4>
+ <p>
+ <?php esc_html_e( 'You can easily filter by dates and search in your log.', Postman::TEXT_DOMAIN ); ?>
+ <img src="<?php echo $this->pluginUrl; ?>/images/filter-preview.gif">
+ </p>
+ </div>
+
+ <div>
+ <h4><?php esc_html_e( 'Multiple emails resend', Postman::TEXT_DOMAIN ); ?></h4>
+ <p>
+ <?php esc_html_e( 'Resend any email to the original recipient or any other emails you choose.', Postman::TEXT_DOMAIN ); ?>
+ <img src="<?php echo $this->pluginUrl; ?>/images/resend-preview.gif">
+ </p>
+ </div>
+ </div>
+ </div>
+
+ <div class="changelog">
+ <h3><?php esc_html_e( 'The best delivery experience', Postman::TEXT_DOMAIN ); ?></h3>
+
+ <div class="feature-section col one-col">
+ <div class="last-feature">
+ <p><?php esc_html_e( 'Easy-to-use, powerful Setup Wizard for perfect configuration,
+ Commercial-grade Connectivity Tester to diagnose server issues,
+ Log and resend all emails; see the exact cause of failed emails,
+ Supports International alphabets, HTML Mail and MultiPart/Alternative,
+ Supports forced recipients (cc, bcc, to) and custom email headers,
+ SASL Support: Plain/Login/CRAM-MD5/XOAUTH2 authentication,
+ Security Support: SMTPS and STARTTLS (SSL/TLS),
+ Copy configuration to other instances of Post.', Postman::TEXT_DOMAIN ); ?></p>
+ </div>
+ </div>
+
+ <div class="feature-section col three-col">
+ <div>
+ <h4><?php esc_html_e( 'Email log HTML preview', Postman::TEXT_DOMAIN ); ?></h4>
+ <p><?php esc_html_e( 'You can now see sent emails as HTML.', Postman::TEXT_DOMAIN ); ?></p>
+ </div>
+
+ <div>
+ <h4><?php esc_html_e( 'Continues email delivery', Postman::TEXT_DOMAIN ); ?></h4>
+ <p><?php esc_html_e( 'if email fail to sent you will get notified using the local mail system.', Postman::TEXT_DOMAIN ); ?></p>
+ </div>
+
+ <div class="last-feature">
+ <h4><?php esc_html_e( 'The best debugging tools.', Postman::TEXT_DOMAIN ); ?></h4>
+ <p><?php esc_html_e( 'Full Transcripts, Connectivity Test, Diagnostic Test.', Postman::TEXT_DOMAIN ); ?></p>
+ </div>
+ </div>
+ </div>
+
+ <div class="return-to-dashboard">
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', Postman::TEXT_DOMAIN ); ?></a>
+ </div>
+
+ </div>
+
+ <?php
+ }
+
+ public function credits_screen() {
+ ?>
+ <style type="text/css">
+ .post-badge {
+ position: absolute;
+ top: 0;
+ right: 0;
+ padding-top: 142px;
+ height: 50px;
+ width: 140px;
+ color: #000;
+ font-weight: bold;
+ font-size: 14px;
+ text-align: center;
+ margin: 0 -5px;
+ background: url( <?php echo $this->pluginUrl; ?>/images/badge.png) no-repeat;
+ }
+ </style>
+ <div class="wrap about-wrap">
+ <h1><?php printf( esc_html__( 'Welcome to Post SMTP %s', Postman::TEXT_DOMAIN ), $this->version ); ?></h1>
+ <div class="about-text"><?php printf( esc_html__( 'Thank you for updating! bbPress %s is waxed, polished, and ready for you to take it for a lap or two around the block!', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
+ <div class="post-badge"><?php printf( esc_html__( 'Version %s', Postman::TEXT_DOMAIN ), $this->version ); ?></div>
+
+ <h2 class="nav-tab-wrapper">
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-about' ), 'index.php' ) ) ); ?>" class="nav-tab">
+ <?php esc_html_e( 'What&#8217;s New', Postman::TEXT_DOMAIN ); ?>
+ </a><a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'post-credits' ), 'index.php' ) ) ); ?>" class="nav-tab nav-tab-active">
+ <?php esc_html_e( 'Credits', Postman::TEXT_DOMAIN ); ?>
+ </a>
+ </h2>
+
+ <p class="about-description"><?php esc_html_e( 'Post SMTP started by Jason Hendriks, Jason left the project and Yehuda Hassine (me) continue his work.', Postman::TEXT_DOMAIN ); ?></p>
+
+ <h4 class="wp-people-group"><?php esc_html_e( 'Project Leaders', Postman::TEXT_DOMAIN ); ?></h4>
+ <ul class="wp-people-group " id="wp-people-group-project-leaders">
+ <li class="wp-person" id="wp-person-jasonhendriks">
+ <a href="https://profiles.wordpress.org/jasonhendriks"><img src="https://secure.gravatar.com/avatar/8692c7b6084517a592f6cad107f7bcb0?s=60&d=mm&r=g" class="gravatar" alt="Jason Hendriks " /></a>
+ <a class="web" href="http://profiles.wordpress.org/matt">Jason Hendriks</a>
+ <span class="title"><?php esc_html_e( 'Founding Developer (abandoned)', Postman::TEXT_DOMAIN ); ?></span>
+ </li>
+ <li class="wp-person" id="wp-person-yehudah">
+ <a href="http://profiles.wordpress.org/yehudah"><img src="https://secure.gravatar.com/avatar/c561638d04ea8fef351f974dbb9ece39?s=60&d=mm&r=g" class="gravatar" alt="Yehuda Hassine" /></a>
+ <a class="web" href="http://profiles.wordpress.org/yehudah">Yehuda Hassine</a>
+ <span class="title"><?php esc_html_e( 'Lead Developer', Postman::TEXT_DOMAIN ); ?></span>
+ </li>
+ </ul>
+
+ <h4 class="wp-people-group"><?php esc_html_e( 'Top Community Members', Postman::TEXT_DOMAIN ); ?></h4>
+ <h5><?php esc_html_e( 'Here I will list top users that help Post SMTP grow (bugs, features, etc...)', Postman::TEXT_DOMAIN ); ?>
+ <p class="wp-credits-list">
+ <a href="http://profiles.wordpress.org/diegocanal">diegocanal</a>,
+ <a href="http://profiles.wordpress.org/jyourstone">Johan Yourstone</a>,
+ <a href="http://profiles.wordpress.org/bodhirayo">bodhirayo</a>,
+ <a href="http://profiles.wordpress.org/buzztone">Neil Murray </a>,
+ <a href="#">A place waiting for you? :-) </a>
+ </p>
+
+ <div class="return-to-dashboard">
+ <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'postman' ), 'admin.php' ) ) ); ?>"><?php esc_html_e( 'Go to Post SMTP Settings', Postman::TEXT_DOMAIN ); ?></a>
+ </div>
+
+ </div>
+
+ <?php
+ }
+}
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogController.php b/Postman/Postman-Email-Log/PostmanEmailLogController.php
index efb19ae..447b6dc 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogController.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogController.php
@@ -363,7 +363,7 @@ class PostmanEmailLogController {
?>
<form id="postman-email-log-filter" method="post">
- <div id="email-log-filter">
+ <div id="email-log-filter" class="postman-log-row">
<div class="form-control">
<label for="from_date"><?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?></label>
<input id="from_date" class="email-log-date" value="<?php echo $from_date; ?>" type="text" name="from_date" placeholder="<?php _e( 'From Date', Postman::TEXT_DOMAIN ); ?>">
@@ -378,11 +378,21 @@ class PostmanEmailLogController {
</div>
<div class="form-control">
<button type="submit" name="filter" class="button button-primary"><?php _e( 'Filter', Postman::TEXT_DOMAIN ); ?></button>
+ </div>
+ </div>
+ <div id="postman-log-actions">
+ <div class="postman-log-row postman-no-sep">
+ <label id="postman_page_records"><?php _e( 'Number of records per page', Postman::TEXT_DOMAIN ); ?></label>
+ <select id="postman_page_records" name="postman_page_records">
+ <option value="10">10</option>
+ <option value="25">25</option>
+ <option value="50">50</option>
+ <option value="75">75</option>
+ <option value="100">100</option>
+ </select>
+ <label id="postman-log-trash-all"><?php _e( 'Trash all records', Postman::TEXT_DOMAIN ); ?></label>
+ <button type="submit" id="postman_trash_all" name="postman_trash_all" class="button button-primary"><?php _e( 'Trash All', Postman::TEXT_DOMAIN ); ?></button>
</div>
-
- <div class="form-control">
- <!-- <button type="submit" name="export_email_logs" class="button button-primary">Export To CSV</button> -->
- </div>
</div>
<div class="error">Please notice: when you select a date for example 11/20/2017, behind the scene the query select <b>11/20/2017 00:00:00</b>.<br>So if you searching for an email arrived that day at any hour you need to select 11/20/2017 as the <b>From Date</b> and 11/21/2017 as the <b>To Date</b>.</div>
</form>
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogService.php b/Postman/Postman-Email-Log/PostmanEmailLogService.php
index 5f57ed8..6c0784b 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogService.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogService.php
@@ -234,10 +234,10 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) {
*
* @return unknown
*/
- function __construct() {
+ function __construct( $args = array() ) {
$this->logger = new PostmanLogger( get_class( $this ) );
- $args = array(
- 'posts_per_page' => 1000,
+ $defaults = array(
+ 'posts_per_page' => -1,
'offset' => 0,
'category' => '',
'category_name' => '',
@@ -253,7 +253,9 @@ if ( ! class_exists( 'PostmanEmailLogPurger' ) ) {
'post_status' => 'private',
'suppress_filters' => true,
);
- $this->posts = get_posts( $args );
+ $args = wp_parse_args( $args, $defaults );
+ $query = new WP_Query( $args );
+ $this->posts = $query->posts;
}
/**
diff --git a/Postman/Postman-Email-Log/PostmanEmailLogView.php b/Postman/Postman-Email-Log/PostmanEmailLogView.php
index fe0fdfe..1d8c4b1 100644
--- a/Postman/Postman-Email-Log/PostmanEmailLogView.php
+++ b/Postman/Postman-Email-Log/PostmanEmailLogView.php
@@ -305,8 +305,10 @@ class PostmanEmailLogView extends WP_List_Table {
* be able to use your precisely-queried data immediately.
*/
$data = array();
+ $posts_per_page = absint( $_POST['postman_page_records'] );
+
$args = array(
- 'posts_per_page' => 1000,
+ 'posts_per_page' => $posts_per_page,
'offset' => 0,
'orderby' => 'date',
'order' => 'DESC',
@@ -339,7 +341,19 @@ class PostmanEmailLogView extends WP_List_Table {
$args['s'] = sanitize_text_field( $_POST['search'] );
}
+ if ( isset( $_POST['postman_trash_all'] ) ) {
+ $args['posts_per_page'] = -1;
+ }
$posts = new WP_query( $args );
+
+ if ( isset( $_POST['postman_trash_all'] ) ) {
+ foreach ( $posts->posts as $post ) {
+ wp_delete_post( $post->ID, true );
+ }
+
+ $posts->posts = array();
+ }
+
$date_format = get_option( 'date_format' );
$time_format = get_option( 'time_format' );
diff --git a/Postman/Postman-Mail/PostmanMessage.php b/Postman/Postman-Mail/PostmanMessage.php
index f9b7dd3..93cb11d 100644
--- a/Postman/Postman-Mail/PostmanMessage.php
+++ b/Postman/Postman-Mail/PostmanMessage.php
@@ -35,7 +35,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) {
// determined by the send() method
private $isTextHtml;
- private $contentType;
+ private $contentType = 'text/plain';
private $charset;
private $boundary;
@@ -81,7 +81,7 @@ if ( ! class_exists( 'PostmanMessage' ) ) {
$this->contentType = sprintf( "%s;\r\n\t boundary=\"%s\"", $this->contentType, $this->getBoundary() );
}
- $body = $this->getBody();
+ $body = $this->getBody();
$contentType = $this->getContentType();
// add the message content as either text or html
if ( empty( $contentType ) || substr( $contentType, 0, 10 ) === 'text/plain' ) {
diff --git a/Postman/Postman-Mail/PostmanTransportRegistry.php b/Postman/Postman-Mail/PostmanTransportRegistry.php
index 01a60bd..77654eb 100644
--- a/Postman/Postman-Mail/PostmanTransportRegistry.php
+++ b/Postman/Postman-Mail/PostmanTransportRegistry.php
@@ -5,34 +5,33 @@ require_once 'PostmanZendMailTransportConfigurationFactory.php';
/**
*
* @author jasonhendriks
- *
*/
class PostmanTransportRegistry {
private $transports;
private $logger;
-
+
/**
*/
private function __construct() {
- $this->logger = new PostmanLogger ( get_class ( $this ) );
+ $this->logger = new PostmanLogger( get_class( $this ) );
}
-
+
// singleton instance
public static function getInstance() {
static $inst = null;
- if ($inst === null) {
- $inst = new PostmanTransportRegistry ();
+ if ( $inst === null ) {
+ $inst = new PostmanTransportRegistry();
}
return $inst;
}
- public function registerTransport(PostmanModuleTransport $instance) {
- $this->transports [$instance->getSlug ()] = $instance;
+ public function registerTransport( PostmanModuleTransport $instance ) {
+ $this->transports [ $instance->getSlug() ] = $instance;
$instance->init();
}
public function getTransports() {
return $this->transports;
}
-
+
/**
* Retrieve a Transport by slug
* Look up a specific Transport use:
@@ -40,85 +39,84 @@ class PostmanTransportRegistry {
* B) when querying what a theoretical scenario involving this transport is like
* (ie.for ajax in config screen)
*
- * @param unknown $slug
+ * @param unknown $slug
*/
- public function getTransport($slug) {
- $transports = $this->getTransports ();
- if (isset ( $transports [$slug] )) {
- return $transports [$slug];
+ public function getTransport( $slug ) {
+ $transports = $this->getTransports();
+ if ( isset( $transports [ $slug ] ) ) {
+ return $transports [ $slug ];
}
}
-
+
/**
* A short-hand way of showing the complete delivery method
*
- * @param PostmanModuleTransport $transport
+ * @param PostmanModuleTransport $transport
* @return string
*/
- public function getPublicTransportUri(PostmanModuleTransport $transport) {
- return $transport->getPublicTransportUri ();
+ public function getPublicTransportUri( PostmanModuleTransport $transport ) {
+ return $transport->getPublicTransportUri();
}
-
+
/**
* Determine if a specific transport is registered in the directory.
*
- * @param unknown $slug
+ * @param unknown $slug
*/
- public function isRegistered($slug) {
- $transports = $this->getTransports ();
- return isset ( $transports [$slug] );
+ public function isRegistered( $slug ) {
+ $transports = $this->getTransports();
+ return isset( $transports [ $slug ] );
}
-
+
/**
* Retrieve the transport Postman is currently configured with.
*
* @return PostmanDummyTransport|PostmanModuleTransport
* @deprecated
- *
*/
public function getCurrentTransport() {
- $selectedTransport = PostmanOptions::getInstance ()->getTransportType ();
- $transports = $this->getTransports ();
- if (! isset ( $transports [$selectedTransport] )) {
+ $selectedTransport = PostmanOptions::getInstance()->getTransportType();
+ $transports = $this->getTransports();
+ if ( ! isset( $transports [ $selectedTransport ] ) ) {
return $transports ['default'];
} else {
- return $transports [$selectedTransport];
+ return $transports [ $selectedTransport ];
}
}
-
+
/**
*
- * @param PostmanOptions $options
- * @param PostmanOAuthToken $token
+ * @param PostmanOptions $options
+ * @param PostmanOAuthToken $token
* @return boolean
*/
public function getActiveTransport() {
- $selectedTransport = PostmanOptions::getInstance ()->getTransportType ();
- $transports = $this->getTransports ();
- if (isset ( $transports [$selectedTransport] )) {
- $transport = $transports [$selectedTransport];
- if ($transport->getSlug () == $selectedTransport && $transport->isConfiguredAndReady ()) {
+ $selectedTransport = PostmanOptions::getInstance()->getTransportType();
+ $transports = $this->getTransports();
+ if ( isset( $transports [ $selectedTransport ] ) ) {
+ $transport = $transports [ $selectedTransport ];
+ if ( $transport->getSlug() == $selectedTransport && $transport->isConfiguredAndReady() ) {
return $transport;
}
}
return $transports ['default'];
}
-
+
/**
* Retrieve the transport Postman is currently configured with.
*
* @return PostmanDummyTransport|PostmanModuleTransport
*/
public function getSelectedTransport() {
- $selectedTransport = PostmanOptions::getInstance ()->getTransportType ();
- $transports = $this->getTransports ();
- if (isset ( $transports [$selectedTransport] )) {
- return $transports [$selectedTransport];
+ $selectedTransport = PostmanOptions::getInstance()->getTransportType();
+ $transports = $this->getTransports();
+ if ( isset( $transports [ $selectedTransport ] ) ) {
+ return $transports [ $selectedTransport ];
} else {
return $transports ['default'];
}
}
-
+
/**
* Determine whether to show the Request Permission link on the main menu
*
@@ -127,47 +125,52 @@ class PostmanTransportRegistry {
* 2. the transport is properly configured
* 3. we have a valid Client ID and Client Secret without an Auth Token
*
- * @param PostmanOptions $options
+ * @param PostmanOptions $options
* @return boolean
*/
- public function isRequestOAuthPermissionAllowed(PostmanOptions $options, PostmanOAuthToken $authToken) {
+ public function isRequestOAuthPermissionAllowed( PostmanOptions $options, PostmanOAuthToken $authToken ) {
// does the current transport use OAuth 2.0
- $oauthUsed = self::getSelectedTransport ()->isOAuthUsed ( $options->getAuthenticationType () );
-
+ $oauthUsed = self::getSelectedTransport()->isOAuthUsed( $options->getAuthenticationType() );
+
// is the transport configured
- if ($oauthUsed) {
- $configured = self::getSelectedTransport ()->isConfiguredAndReady ();
+ if ( $oauthUsed ) {
+ $configured = self::getSelectedTransport()->isConfiguredAndReady();
}
-
+
return $oauthUsed && $configured;
}
-
+
/**
* Polls all the installed transports to get a complete list of sockets to probe for connectivity
*
- * @param unknown $hostname
- * @param unknown $isGmail
+ * @param unknown $hostname
+ * @param unknown $isGmail
* @return multitype:
*/
- public function getSocketsForSetupWizardToProbe($hostname = 'localhost', $smtpServerGuess = null) {
- $hosts = array ();
- if ($this->logger->isDebug ()) {
- $this->logger->debug ( sprintf ( 'Getting sockets for Port Test given hostname %s and smtpServerGuess %s', $hostname, $smtpServerGuess ) );
+ public function getSocketsForSetupWizardToProbe( $hostname = 'localhost', $smtpServerGuess = null ) {
+ $hosts = array();
+ if ( $this->logger->isDebug() ) {
+ $this->logger->debug( sprintf( 'Getting sockets for Port Test given hostname %s and smtpServerGuess %s', $hostname, $smtpServerGuess ) );
+ }
+
+ $transports = $this->getTransports();
+ if ( $hostname !== 'smtp.gmail.com' ) {
+ unset( $transports['gmail_api'] );
}
- foreach ( $this->getTransports () as $transport ) {
- $socketsToTest = $transport->getSocketsForSetupWizardToProbe ( $hostname, $smtpServerGuess );
- if ($this->logger->isTrace ()) {
- $this->logger->trace ( 'sockets to test:' );
- $this->logger->trace ( $socketsToTest );
+ foreach ( $transports as $transport ) {
+ $socketsToTest = $transport->getSocketsForSetupWizardToProbe( $hostname, $smtpServerGuess );
+ if ( $this->logger->isTrace() ) {
+ $this->logger->trace( 'sockets to test:' );
+ $this->logger->trace( $socketsToTest );
}
- $hosts = array_merge ( $hosts, $socketsToTest );
- if ($this->logger->isDebug ()) {
- $this->logger->debug ( sprintf ( 'Transport %s returns %d sockets ', $transport->getName (), sizeof ( $socketsToTest ) ) );
+ $hosts = array_merge( $hosts, $socketsToTest );
+ if ( $this->logger->isDebug() ) {
+ $this->logger->debug( sprintf( 'Transport %s returns %d sockets ', $transport->getName(), sizeof( $socketsToTest ) ) );
}
}
return $hosts;
}
-
+
/**
* If the host port is a possible configuration option, recommend it
*
@@ -175,63 +178,63 @@ class PostmanTransportRegistry {
*
* response should include ['success'], ['message'], ['priority']
*
- * @param unknown $hostData
+ * @param unknown $hostData
*/
- public function getRecommendation(PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer) {
- $scrubbedUserAuthOverride = $this->scrubUserOverride ( $hostData, $userAuthOverride );
- $transport = $this->getTransport ( $hostData->transport );
- $recommendation = $transport->getConfigurationBid ( $hostData, $scrubbedUserAuthOverride, $originalSmtpServer );
- if ($this->logger->isDebug ()) {
- $this->logger->debug ( sprintf ( 'Transport %s bid %s', $transport->getName (), $recommendation ['priority'] ) );
+ public function getRecommendation( PostmanWizardSocket $hostData, $userAuthOverride, $originalSmtpServer ) {
+ $scrubbedUserAuthOverride = $this->scrubUserOverride( $hostData, $userAuthOverride );
+ $transport = $this->getTransport( $hostData->transport );
+ $recommendation = $transport->getConfigurationBid( $hostData, $scrubbedUserAuthOverride, $originalSmtpServer );
+ if ( $this->logger->isDebug() ) {
+ $this->logger->debug( sprintf( 'Transport %s bid %s', $transport->getName(), $recommendation ['priority'] ) );
}
return $recommendation;
}
-
+
/**
*
- * @param PostmanWizardSocket $hostData
- * @param unknown $userAuthOverride
+ * @param PostmanWizardSocket $hostData
+ * @param unknown $userAuthOverride
* @return NULL
*/
- private function scrubUserOverride(PostmanWizardSocket $hostData, $userAuthOverride) {
- $this->logger->trace ( 'before scrubbing userAuthOverride: ' . $userAuthOverride );
-
+ private function scrubUserOverride( PostmanWizardSocket $hostData, $userAuthOverride ) {
+ $this->logger->trace( 'before scrubbing userAuthOverride: ' . $userAuthOverride );
+
// validate userAuthOverride
- if (! ($userAuthOverride == 'oauth2' || $userAuthOverride == 'password' || $userAuthOverride == 'none')) {
+ if ( ! ($userAuthOverride == 'oauth2' || $userAuthOverride == 'password' || $userAuthOverride == 'none') ) {
$userAuthOverride = null;
}
-
+
// validate the userAuthOverride
- if (! $hostData->auth_xoauth) {
- if ($userAuthOverride == 'oauth2') {
+ if ( ! $hostData->auth_xoauth ) {
+ if ( $userAuthOverride == 'oauth2' ) {
$userAuthOverride = null;
}
}
- if (! $hostData->auth_crammd5 && ! $hostData->authPlain && ! $hostData->auth_login) {
- if ($userAuthOverride == 'password') {
+ if ( ! $hostData->auth_crammd5 && ! $hostData->authPlain && ! $hostData->auth_login ) {
+ if ( $userAuthOverride == 'password' ) {
$userAuthOverride = null;
}
}
- if (! $hostData->auth_none) {
- if ($userAuthOverride == 'none') {
+ if ( ! $hostData->auth_none ) {
+ if ( $userAuthOverride == 'none' ) {
$userAuthOverride = null;
}
}
- $this->logger->trace ( 'after scrubbing userAuthOverride: ' . $userAuthOverride );
+ $this->logger->trace( 'after scrubbing userAuthOverride: ' . $userAuthOverride );
return $userAuthOverride;
}
-
+
/**
*/
public function getReadyMessage() {
- if ($this->getCurrentTransport ()->isConfiguredAndReady ()) {
- if (PostmanOptions::getInstance ()->getRunMode () != PostmanOptions::RUN_MODE_PRODUCTION) {
- return __ ( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN );
+ if ( $this->getCurrentTransport()->isConfiguredAndReady() ) {
+ if ( PostmanOptions::getInstance()->getRunMode() != PostmanOptions::RUN_MODE_PRODUCTION ) {
+ return __( 'Postman is in <em>non-Production</em> mode and is dumping all emails.', Postman::TEXT_DOMAIN );
} else {
- return __ ( 'Postman is configured.', Postman::TEXT_DOMAIN );
+ return __( 'Postman is configured.', Postman::TEXT_DOMAIN );
}
} else {
- return __ ( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN );
+ return __( 'Postman is <em>not</em> configured and is mimicking out-of-the-box WordPress email delivery.', Postman::TEXT_DOMAIN );
}
}
}
diff --git a/Postman/Postman.php b/Postman/Postman.php
index 23351e7..69c23b8 100644
--- a/Postman/Postman.php
+++ b/Postman/Postman.php
@@ -203,6 +203,7 @@ class Postman {
// load the dependencies
require_once 'PostmanMessageHandler.php';
require_once 'PostmanAdminController.php';
+ require_once 'Postman-Controller/PostmanWelcomeController.php';
require_once 'Postman-Controller/PostmanDashboardWidgetController.php';
require_once 'Postman-Controller/PostmanAdminPointer.php';
require_once 'Postman-Email-Log/PostmanEmailLogController.php';
@@ -215,6 +216,7 @@ class Postman {
$this->messageHandler = new PostmanMessageHandler();
// create the Admin Controllers
+ new PostmanWelcomeController( $rootPluginFilenameAndPath );
new PostmanDashboardWidgetController( $rootPluginFilenameAndPath, $options, $authToken, $this->wpMailBinder );
new PostmanAdminController( $rootPluginFilenameAndPath, $options, $authToken, $this->messageHandler, $this->wpMailBinder );
new PostmanEmailLogController( $rootPluginFilenameAndPath );
diff --git a/Postman/PostmanInstaller.php b/Postman/PostmanInstaller.php
index 170ccf1..812f122 100644
--- a/Postman/PostmanInstaller.php
+++ b/Postman/PostmanInstaller.php
@@ -1,6 +1,6 @@
<?php
-require_once ('PostmanOAuthToken.php');
-require_once ('PostmanOptions.php');
+require_once( 'PostmanOAuthToken.php' );
+require_once( 'PostmanOptions.php' );
/**
* If required, database upgrades are made during activation
@@ -11,129 +11,137 @@ require_once ('PostmanOptions.php');
*/
class PostmanInstaller {
private $logger;
-
+
/**
*/
public function __construct() {
- $this->logger = new PostmanLogger ( get_class ( $this ) );
+ $this->logger = new PostmanLogger( get_class( $this ) );
}
-
+
/**
* Handle activation of the plugin
*/
public function activatePostman() {
- if (function_exists ( 'is_multisite' ) && is_multisite ()) {
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
// handle network activation
// from https://wordpress.org/support/topic/new-function-wp_get_sites?replies=11
-
// run the activation function for each blog id
- $old_blog = get_current_blog_id ();
+ $old_blog = get_current_blog_id();
// Get all blog ids
- $subsites = wp_get_sites ();
+ $subsites = wp_get_sites();
foreach ( $subsites as $subsite ) {
- $this->logger->trace ( 'multisite: switching to blog ' . $subsite ['blog_id'] );
- switch_to_blog ( $subsite ['blog_id'] );
- $this->handleOptionUpdates ();
- $this->addCapability ();
+ $this->logger->trace( 'multisite: switching to blog ' . $subsite ['blog_id'] );
+ switch_to_blog( $subsite ['blog_id'] );
+ $this->handleOptionUpdates();
+ $this->addCapability();
}
- switch_to_blog ( $old_blog );
+ switch_to_blog( $old_blog );
} else {
// handle single-site activation
- $this->handleOptionUpdates ();
- $this->addCapability ();
+ $this->handleOptionUpdates();
+ $this->addCapability();
}
+
+ $this->add_activation_redirect();
+ }
+
+ function add_activation_redirect() {
+
+ // Bail if activating from network, or bulk
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
+ return; }
+
+ // Add the transient to redirect
+ set_transient( '_post_activation_redirect', true, 30 );
}
-
+
/**
* Handle deactivation of the plugin
*/
public function deactivatePostman() {
- if (function_exists ( 'is_multisite' ) && is_multisite ()) {
+ if ( function_exists( 'is_multisite' ) && is_multisite() ) {
// handle network deactivation
// from https://wordpress.org/support/topic/new-function-wp_get_sites?replies=11
-
// run the deactivation function for each blog id
- $old_blog = get_current_blog_id ();
+ $old_blog = get_current_blog_id();
// Get all blog ids
- $subsites = wp_get_sites ();
+ $subsites = wp_get_sites();
foreach ( $subsites as $subsite ) {
- $this->logger->trace ( 'multisite: switching to blog ' . $subsite ['blog_id'] );
- switch_to_blog ( $subsite ['blog_id'] );
- $this->removeCapability ();
+ $this->logger->trace( 'multisite: switching to blog ' . $subsite ['blog_id'] );
+ switch_to_blog( $subsite ['blog_id'] );
+ $this->removeCapability();
}
- switch_to_blog ( $old_blog );
+ switch_to_blog( $old_blog );
} else {
// handle single-site deactivation
- $this->removeCapability ();
+ $this->removeCapability();
}
}
-
+
/**
* Add the capability to manage postman
*/
public function addCapability() {
- if ($this->logger->isDebug ()) {
- $this->logger->debug ( 'Adding admin capability' );
+ if ( $this->logger->isDebug() ) {
+ $this->logger->debug( 'Adding admin capability' );
}
// ref: https://codex.wordpress.org/Function_Reference/add_cap
// NB: This setting is saved to the database, so it might be better to run this on theme/plugin activation
-
// add the custom capability to the administrator role
- $role = get_role ( Postman::ADMINISTRATOR_ROLE_NAME );
- $role->add_cap ( Postman::MANAGE_POSTMAN_CAPABILITY_NAME );
+ $role = get_role( Postman::ADMINISTRATOR_ROLE_NAME );
+ $role->add_cap( Postman::MANAGE_POSTMAN_CAPABILITY_NAME );
}
-
+
/**
* Remove the capability to manage postman
*/
public function removeCapability() {
- if ($this->logger->isDebug ()) {
- $this->logger->debug ( 'Removing admin capability' );
+ if ( $this->logger->isDebug() ) {
+ $this->logger->debug( 'Removing admin capability' );
}
// ref: https://codex.wordpress.org/Function_Reference/add_cap
// NB: This setting is saved to the database, so it might be better to run this on theme/plugin activation
-
// remove the custom capability from the administrator role
- $role = get_role ( Postman::ADMINISTRATOR_ROLE_NAME );
- $role->remove_cap ( Postman::MANAGE_POSTMAN_CAPABILITY_NAME );
+ $role = get_role( Postman::ADMINISTRATOR_ROLE_NAME );
+ $role->remove_cap( Postman::MANAGE_POSTMAN_CAPABILITY_NAME );
}
-
+
/**
* Handle activation of plugin
*/
private function handleOptionUpdates() {
- $this->logger->debug ( "Activating plugin" );
+ $this->logger->debug( 'Activating plugin' );
// prior to version 0.2.5, $authOptions did not exist
- $authOptions = get_option ( 'postman_auth_token' );
- $options = get_option ( 'postman_options' );
- $postmanState = get_option ( 'postman_state' );
- if (empty ( $authOptions ) && ! (empty ( $options )) && ! empty ( $options ['access_token'] )) {
- $this->logger->debug ( "Upgrading database: copying Authorization token from postman_options to postman_auth_token" );
+ $authOptions = get_option( 'postman_auth_token' );
+ $options = get_option( 'postman_options' );
+ $postmanState = get_option( 'postman_state' );
+ if ( empty( $authOptions ) && ! (empty( $options )) && ! empty( $options ['access_token'] ) ) {
+ $this->logger->debug( 'Upgrading database: copying Authorization token from postman_options to postman_auth_token' );
// copy the variables from $options to $authToken
$authOptions ['access_token'] = $options ['access_token'];
$authOptions ['refresh_token'] = $options ['refresh_token'];
// there was a bug where we weren't setting the expiry time
- if (! empty ( $options ['auth_token_expires'] )) {
+ if ( ! empty( $options ['auth_token_expires'] ) ) {
$authOptions ['auth_token_expires'] = $options ['auth_token_expires'];
}
- update_option ( 'postman_auth_token', $authOptions );
+ update_option( 'postman_auth_token', $authOptions );
}
- if (! isset ( $options ['authorization_type'] ) && ! isset ( $options ['auth_type'] )) {
+ if ( ! isset( $options ['authorization_type'] ) && ! isset( $options ['auth_type'] ) ) {
// prior to 1.0.0, access tokens were saved in authOptions without an auth type
// prior to 0.2.5, access tokens were save in options without an auth type
// either way, only oauth2 was supported
- if (isset ( $authOptions ['access_token'] ) || isset ( $options ['access_token'] )) {
- $this->logger->debug ( "Upgrading database: setting authorization_type to 'oauth2'" );
+ if ( isset( $authOptions ['access_token'] ) || isset( $options ['access_token'] ) ) {
+ $this->logger->debug( "Upgrading database: setting authorization_type to 'oauth2'" );
$options ['authorization_type'] = 'oauth2';
- update_option ( 'postman_options', $options );
+ update_option( 'postman_options', $options );
}
}
- if (! isset ( $options ['enc_type'] )) {
+ if ( ! isset( $options ['enc_type'] ) ) {
// prior to 1.3, encryption type was combined with authentication type
- if (isset ( $options ['authorization_type'] )) {
- $this->logger->debug ( "Upgrading database: creating auth_type and enc_type from authorization_type" );
+ if ( isset( $options ['authorization_type'] ) ) {
+ $this->logger->debug( 'Upgrading database: creating auth_type and enc_type from authorization_type' );
$authType = $options ['authorization_type'];
- switch ($authType) {
+ switch ( $authType ) {
case 'none' :
$options ['auth_type'] = 'none';
$options ['enc_type'] = 'none';
@@ -152,81 +160,78 @@ class PostmanInstaller {
break;
default :
}
- update_option ( 'postman_options', $options );
+ update_option( 'postman_options', $options );
}
}
// prior to 1.3.3, the version identifier was not stored and the passwords were plaintext
- if (isset ( $options ['enc_type'] ) && ! (isset ( $options ['version'] ) || isset ( $postmanState ['version'] ))) {
- $this->logger->debug ( "Upgrading database: added plugin version and encoding password" );
+ if ( isset( $options ['enc_type'] ) && ! (isset( $options ['version'] ) || isset( $postmanState ['version'] )) ) {
+ $this->logger->debug( 'Upgrading database: added plugin version and encoding password' );
$options ['version'] = '1.3.3';
- if (isset ( $options ['basic_auth_password'] )) {
- $options ['basic_auth_password'] = base64_encode ( $options ['basic_auth_password'] );
+ if ( isset( $options ['basic_auth_password'] ) ) {
+ $options ['basic_auth_password'] = base64_encode( $options ['basic_auth_password'] );
}
- update_option ( 'postman_options', $options );
+ update_option( 'postman_options', $options );
}
// prior to 1.4.2, the transport was not identified and the auth token had no vendor
- if (isset ( $options ['auth_type'] ) && ! isset ( $options ['transport_type'] )) {
- $this->logger->debug ( "Upgrading database: added transport_type and vendor_name" );
+ if ( isset( $options ['auth_type'] ) && ! isset( $options ['transport_type'] ) ) {
+ $this->logger->debug( 'Upgrading database: added transport_type and vendor_name' );
$options ['transport_type'] = 'smtp';
- update_option ( 'postman_options', $options );
- if (isset ( $authOptions ['access_token'] ) && isset ( $options ['oauth_client_id'] )) {
+ update_option( 'postman_options', $options );
+ if ( isset( $authOptions ['access_token'] ) && isset( $options ['oauth_client_id'] ) ) {
// if there is a stored token..
- if (PostmanUtils::endsWith ( $options ['oauth_client_id'], 'googleusercontent.com' ))
- $authOptions ['vendor_name'] = 'google';
- else if (strlen ( $options ['oauth_client_id'] < strlen ( $options ['oauth_client_secret'] ) ))
+ if ( PostmanUtils::endsWith( $options ['oauth_client_id'], 'googleusercontent.com' ) ) {
+ $authOptions ['vendor_name'] = 'google'; } else if ( strlen( $options ['oauth_client_id'] < strlen( $options ['oauth_client_secret'] ) ) ) {
$authOptions ['vendor_name'] = 'microsoft';
- else
- $authOptions ['vendor_name'] = 'yahoo';
- update_option ( 'postman_auth_token', $authOptions );
+ } else { $authOptions ['vendor_name'] = 'yahoo'; }
+ update_option( 'postman_auth_token', $authOptions );
}
}
-
+
// for version 1.6.18, the envelope from was introduced
- if (! empty ( $options ['sender_email'] ) && empty ( $options ['envelope_sender'] )) {
- $this->logger->debug ( "Upgrading database: adding envelope_sender" );
+ if ( ! empty( $options ['sender_email'] ) && empty( $options ['envelope_sender'] ) ) {
+ $this->logger->debug( 'Upgrading database: adding envelope_sender' );
$options ['envelope_sender'] = $options ['sender_email'];
- update_option ( 'postman_options', $options );
+ update_option( 'postman_options', $options );
}
-
- if (isset ( $postmanState ['version'] ) && version_compare ( $postmanState ['version'], '1.7.0', '<' )) {
- if ($options ['mail_log_max_entries'] == 10) {
+
+ if ( isset( $postmanState ['version'] ) && version_compare( $postmanState ['version'], '1.7.0', '<' ) ) {
+ if ( $options ['mail_log_max_entries'] == 10 ) {
$options ['mail_log_max_entries'] = 250;
}
- $postmanStats = get_option ( 'postman_stats' );
+ $postmanStats = get_option( 'postman_stats' );
$stateCleared = false;
- if (! isset ( $postmanState ['delivery_success_total'] ) && isset ( $postmanStats ['delivery_success_total'] )) {
+ if ( ! isset( $postmanState ['delivery_success_total'] ) && isset( $postmanStats ['delivery_success_total'] ) ) {
$postmanState ['delivery_success_total'] = $postmanStats ['delivery_success_total'];
$stateCleared = true;
}
- if (! isset ( $postmanState ['delivery_fail_total'] ) && isset ( $postmanStats ['delivery_fail_total'] )) {
+ if ( ! isset( $postmanState ['delivery_fail_total'] ) && isset( $postmanStats ['delivery_fail_total'] ) ) {
$postmanState ['delivery_fail_total'] = $postmanStats ['delivery_fail_total'];
$stateCleared = true;
}
- if ($stateCleared) {
- delete_option ( 'postman_stats' );
+ if ( $stateCleared ) {
+ delete_option( 'postman_stats' );
}
}
-
+
// can we create a tmp file? - this code is duplicated in InputSanitizer
- PostmanUtils::deleteLockFile ();
- $lockSuccess = PostmanUtils::createLockFile ();
+ PostmanUtils::deleteLockFile();
+ $lockSuccess = PostmanUtils::createLockFile();
// &= does not work as expected in my PHP
- $lockSuccess = $lockSuccess && PostmanUtils::deleteLockFile ();
+ $lockSuccess = $lockSuccess && PostmanUtils::deleteLockFile();
$postmanState ['locking_enabled'] = $lockSuccess;
-
+
// always update the version number
- if (! isset ( $postmanState ['install_date'] )) {
- $this->logger->debug ( "Upgrading database: adding install_date" );
- $postmanState ['install_date'] = time ();
+ if ( ! isset( $postmanState ['install_date'] ) ) {
+ $this->logger->debug( 'Upgrading database: adding install_date' );
+ $postmanState ['install_date'] = time();
}
- $pluginData = apply_filters ( 'postman_get_plugin_metadata', null );
+ $pluginData = apply_filters( 'postman_get_plugin_metadata', null );
$postmanState ['version'] = $pluginData ['version'];
- update_option ( 'postman_state', $postmanState );
- //
- delete_option ( 'postman_session' );
-
+ update_option( 'postman_state', $postmanState );
+ delete_option( 'postman_session' );
+
// reload options
- PostmanState::getInstance ()->reload ();
- PostmanOptions::getInstance ()->reload ();
+ PostmanState::getInstance()->reload();
+ PostmanOptions::getInstance()->reload();
}
}
diff --git a/Postman/PostmanPluginFeedback.php b/Postman/PostmanPluginFeedback.php
index 3ac985d..b31011d 100644
--- a/Postman/PostmanPluginFeedback.php
+++ b/Postman/PostmanPluginFeedback.php
@@ -110,13 +110,13 @@ class PostmanPluginFeedback {
<li class="postman-reason">
<label>
- <span><input value="bad support" type="radio" name="reason" checked/></span>
- <span><?php _e( 'Bad Support', 'postman' ); ?></span>
+ <span><input value="no time for this" type="radio" name="reason" checked/></span>
+ <span><?php _e( 'I have no time for this', 'postman' ); ?></span>
</label>
</li>
<li class="postman-reason postman-custom-input">
<label>
- <span><input value="Found a better plugin" type="radio" name="reason" /></span>
+ <span><input value="Found a better plugin" type="radio" name="reason" data-reason="What is the name of the plugin?" /></span>
<span><?php _e( 'Found a better plugin', 'postman' ); ?></span>
</label>
</li>
@@ -145,7 +145,7 @@ class PostmanPluginFeedback {
</li>
</ul>
<div class="postman-reason-input" style="display: none;">
- <input type="text" class="regular-text" name="other_input" placeholder="Do you mind help and give more detailes?">
+ <input type="text" class="regular-text" name="other_input" placeholder="">
</div>
</form>
</div>
diff --git a/Postman/PostmanViewController.php b/Postman/PostmanViewController.php
index 99c3018..964e266 100644
--- a/Postman/PostmanViewController.php
+++ b/Postman/PostmanViewController.php
@@ -35,11 +35,34 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
PostmanUtils::registerAdminMenu( $this, 'addPurgeDataSubmenu' );
// initialize the scripts, stylesheets and form fields
- add_action( 'admin_init', array(
- $this,
- 'registerStylesAndScripts',
- ), 0 );
+ add_action( 'admin_init', array( $this, 'registerStylesAndScripts' ), 0 );
+ add_action( 'admin_init', array( $this, 'do_activation_redirect' ) );
+
+ }
+
+ function do_activation_redirect() {
+
+ // Bail if no activation redirect
+ if ( ! get_transient( '_post_activation_redirect' ) ) {
+ return;
+ }
+
+ // Delete the redirect transient
+ // delete_transient( '_post_activation_redirect' );
+ // Bail if activating from network, or bulk
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
+ return;
+ }
+
+ // Bail if the current user cannot see the about page
+ if ( ! current_user_can( 'manage_options' ) ) {
+ return;
+ }
+
+ // Redirect to bbPress about page
+ wp_safe_redirect( add_query_arg( array( 'page' => 'post-about' ), admin_url( 'index.php' ) ) );
}
+
public static function getPageUrl( $slug ) {
return PostmanUtils::getPageUrl( $slug );
}