Automator_Recipe_Process_User::maybe_get_trigger_id( $user_id,  $trigger_id,  $recipe_id, null $recipe_log_id = null )

Record an entry in to DB against a trigger


Parameters Parameters

$user_id

(Required)

$trigger_id

(Required)

$recipe_id

(Required)

$recipe_log_id

(null) (Optional)

Default value: null


Top ↑

Return Return

(array)


Source Source

File: src/core/lib/process/class-automator-recipe-process-user.php

	public function maybe_get_trigger_id( $user_id, $trigger_id, $recipe_id, $recipe_log_id = null ) {
		if ( null === $trigger_id || null === $recipe_id || null === $user_id ) {
			return array(
				'result' => false,
				'error'  => __( 'One of the required field is missing.', 'uncanny-automator' ),
			);
		}

		$get_trigger_id = Automator()->get->trigger_log_id( $user_id, $trigger_id, $recipe_id, $recipe_log_id );

		if ( is_null( $get_trigger_id ) && is_numeric( $recipe_log_id ) ) {
			//Nothing found! Insert
			$get_trigger_id = $this->insert_trigger( $user_id, $trigger_id, $recipe_id, false, $recipe_log_id );
		}

		return array(
			'result'         => true,
			'trigger_log_id' => $get_trigger_id,
		);
	}