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...
		$sent_notification = get_post_meta( $post->ID, 'noptin_sent_notification_campaign', true );

		// A notification was sent for this blog post.
		if ( is_array( $sent_notification ) && $post->ID == $sent_notification[0] ) {
			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 );
			}

		}

	}


Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation