deactivate_noptin_subscriber( $subscriber )

De-activates a Noptin subscriber


Source Source

File: includes/subscriber.php

function deactivate_noptin_subscriber( $subscriber ) {
	global $wpdb;

	// Prepare the subscriber.
	$subscriber = new Noptin_Subscriber( $subscriber );
	if ( ! $subscriber->exists() || ! empty( $subscriber->active ) ) {
		return false;
	}

	do_action( 'noptin_before_deactivate_subscriber', $subscriber );

	$wpdb->update(
		get_noptin_subscribers_table_name(),
		array( 'active' => 1 ),
		array( 'id' => $subscriber->id ),
		'%d',
		'%d'
	);

	update_noptin_subscriber_meta( $subscriber->id, 'unsubscribed_on', current_time( 'mysql' ) );
	$subscriber->clear_cache();

	return true;

}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.3.1Introduced.

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