/** * Any time a post is published schedule notifications. * * @param string $new_status * @param string $old_status * @param WP_Post $post */ public static function action_transition_post_status($new_status, $old_status, $post) { if (!Prompt_Core::$options->get('enable_post_delivery')) { return; } if ('publish' == $old_status or 'publish' != $new_status) { return; } // There is no way to suppress mailing when restoring a trashed post, so we always do it if ('trash' == $old_status) { return; } if (defined('WP_IMPORTING') and WP_IMPORTING) { return; } if (self::ignore_published_post($post->ID)) { return; } $prompt_post = new Prompt_Post($post); if (!$prompt_post->unsent_recipient_ids() or Prompt_Admin_Delivery_Metabox::suppress_email($post->ID)) { return; } Prompt_Post_Mailing::send_notifications($post); }