OPTINMONSTER_SHOW_CAMPAIGN::process_action( int $user_id, array $action_data, int $recipe_id, array $args,  $parsed )

Proccess our action.


Parameters Parameters

$user_id

(Required)

$action_data

(Required)

$recipe_id

(Required)

$args

(Required)

$parsed

(Required)


Top ↑

Return Return

(Uncanny_Automatorvoid.)


Source Source

File: src/integrations/optinmonster/actions/optinmonster-show-campaign.php

	protected function process_action( $user_id, $action_data, $recipe_id, $args, $parsed ) {

		$campaign = isset( $parsed[ $this->get_action_meta() ] ) ? sanitize_text_field( $parsed[ $this->get_action_meta() ] ) : '';

		if ( ! Automator()->helpers->recipe->optinmonster->campaign_is_active( $campaign ) ) {

			$error_message                       = __( 'The campaign is not active', 'uncanny-automator' );
			$action_data['complete_with_errors'] = true;
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $error_message );

			return;
		}

		$this->set_cookie( $campaign );

		Automator()->complete->action( $user_id, $action_data, $recipe_id );

	}