ANON_FCRM_CONTACT_STATUS_UPDATED::get_matched_recipes_ids( mixed $uncanny_automator, mixed $trigger, mixed $subscriber = null )

Get the matching recipe ids.


Parameters Parameters

$uncanny_automator

(mixed) (Required) The uncanny_automator global object.

$trigger

(mixed) (Required) The trigger. Must be an instance of Uncanny_AutomatorFCRM_USER_STATUS_UPDATED.

$subscriber

(mixed) (Optional) The subscriber object.

Default value: null


Top ↑

Return Return

(array) The matching recipe ids.


Source Source

File: src/integrations/fluent-crm/triggers/anon-fcrm-contact-status-updated.php

	public function get_matched_recipes_ids( $uncanny_automator, FCRM_USER_STATUS_UPDATED $trigger, $subscriber = null ) {
		$recipes            = Automator()->get->recipes_from_trigger_code( $trigger->get_trigger_code() );
		$status             = Automator()->get->meta_from_recipes( $recipes, $trigger->get_trigger_code() );
		$matched_recipe_ids = array();
		foreach ( $recipes as $recipe_id => $recipe ) {
			foreach ( $recipe['triggers'] as $trigger ) {
				$trigger_id = $trigger['ID'];
				// Check to see if trigger matches `Any` trigger or a specific Event.
				$selected_option = $status[ $recipe_id ][ $trigger_id ];
				if ( intval( '-1' ) === intval( $selected_option ) || $selected_option === $subscriber->status ) {
					$matched_recipe_ids[] = array(
						'recipe_id'  => $recipe_id,
						'trigger_id' => $trigger_id,
					);
				}
			}
		}

		return $matched_recipe_ids;
	}