Noptin_Ajax::admin_add_subscriber()

Manually add a new subscriber via ajax


Return Return

(void)


Top ↑

Source Source

File: includes/class-noptin-ajax.php

	public function admin_add_subscriber() {

		// Ensure the nonce is valid...
		check_ajax_referer( 'noptin_subscribers' );

		// ... and that the user can import subscribers.
		if ( ! current_user_can( get_noptin_capability() ) ) {
			wp_die( -1, 403 );
		}

		$fields = array(
			'name'            => $_POST['name'],
			'email'           => $_POST['email'],
			'_subscriber_via' => 'manual',
		);

		$inserted = add_noptin_subscriber( $fields );

		if ( is_string( $inserted ) ) {
			die( $inserted );
		}

		do_action( 'noptin_after_admin_add_subscriber', $inserted );

		wp_send_json_success( true );
		exit;
	}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.6Introduced.

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