AUTONAMI_ADD_CONTACT_TAG::process_action( $user_id,  $action_data,  $recipe_id,  $args,  $parsed )

Method process_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/autonami/actions/autonami-add-contact-tag.php

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

			$email_field_value = $action_data['meta']['EMAIL'];
			$parsed_email      = Automator()->parse->text( $email_field_value, $recipe_id, $user_id, $args );
			$email             = sanitize_email( $parsed_email );

			$tag_id       = absint( $action_data['meta'][ $this->action_meta ] );
			$tag_readable = $action_data['meta'][ $this->action_meta . '_readable' ];

			$this->helpers->add_tag_to_contact( $email, $tag_id, $tag_readable );

			Automator()->complete_action( $user_id, $action_data, $recipe_id );

		} catch ( \Exception $e ) {
			$action_data['do-nothing']           = true;
			$action_data['complete_with_errors'] = true;
			Automator()->complete_action( $user_id, $action_data, $recipe_id, $e->getMessage() );
		}
	}