Noptin_Ajax::save_rule()

Saves rules


Source Source

File: includes/class-noptin-ajax.php

	public function save_rule() {

		if ( ! current_user_can( get_noptin_capability() ) ) {
			wp_die( -1, 403 );
		}

		// Check nonce.
		check_ajax_referer( 'noptin_automation_rules' );

		/**
		 * Runs before saving rules
		 */
		do_action( 'noptin_before_save_automation_rule' );

		// Prepare the rule.
		$trigger_settings = array();
		if ( ! empty( $_POST['trigger_settings'] ) ) {
			$trigger_settings = stripslashes_deep( $_POST['trigger_settings'] );
		}

		$action_settings = array();
		if ( ! empty( $_POST['action_settings'] ) ) {
			$action_settings = stripslashes_deep( $_POST['action_settings'] );
		}

		// Save them.
		noptin()->automation_rules->update_rule( $_POST['id'], compact( 'action_settings', 'trigger_settings' ) );

		wp_send_json_success( 1 );

	}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.3.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