log_noptin_subscriber_campaign_open( int $subscriber_id, string $campaign_id )

Logs whenever a subscriber opens an email


Parameters Parameters

$subscriber_id

(int) (Required) Subscriber ID.

$campaign_id

(string) (Required) The opened email campaign.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/subscriber.php

function log_noptin_subscriber_campaign_open( $subscriber_id, $campaign_id ) {

	$opened_campaigns = get_noptin_subscriber_opened_campaigns( $subscriber_id );
	if ( ! in_array( (int) $campaign_id, $opened_campaigns, true ) ) {
		$opened_campaigns[] = $campaign_id;
		update_noptin_subscriber_meta( $subscriber_id, '_opened_campaigns', $opened_campaigns );
		update_noptin_subscriber_meta( $subscriber_id, "_campaign_{$campaign_id}_opened", 1 );

		if ( is_int( $campaign_id ) ) {
			$open_counts = (int) get_post_meta( $campaign_id, '_noptin_opens', true );
			update_post_meta( $campaign_id, '_noptin_opens', $open_counts + 1 );

		}

		do_action( 'log_noptin_subscriber_campaign_open', $subscriber_id, $campaign_id );

	}

}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.0Introduced.

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