Noptin_New_Post_Notify::maybe_schedule_notification( $new_status, $old_status, $post )
Notify subscribers when new content is published
Source Source
File: includes/class-noptin-new-post-notify.php
public function maybe_schedule_notification( $new_status, $old_status, $post ) { // Ensure the post is published. if ( 'publish' === $old_status || 'publish' !== $new_status ) { return; } // If a notification has already been send abort... if ( get_post_meta( $post->ID, 'noptin_associated_new_post_notification_campaign', true ) ) { return; } // Are there any new post automations. $automations = $this->get_automations(); if ( empty( $automations ) ) { return; } foreach ( $automations as $automation ) { // Check if the automation applies here. if ( $this->is_automation_valid_for( $automation, $post ) ) { $this->schedule_notification( $post, $automation ); } } }
Expand full source code Collapse full source code View on GitHub