Automator_DB_Handler_Triggers::mark_complete( $trigger_id,  $user_id,  $recipe_id,  $recipe_log_id,  $trigger_log_id )


Parameters Parameters

$trigger_id

(Required)

$user_id

(Required)

$recipe_id

(Required)

$recipe_log_id

(Required)

$trigger_log_id

(Required)


Top ↑

Return Return

(bool|int)


Source Source

File: src/core/lib/utilities/db/class-automator-db-handler-triggers.php

	public function mark_complete( int $trigger_id, int $user_id, int $recipe_id, int $recipe_log_id, int $trigger_log_id ) {
		$update = array(
			'completed' => true,
			'date_time' => current_time( 'mysql' ),
		);

		$where = array(
			'user_id'              => $user_id,
			'automator_trigger_id' => $trigger_id,
			'automator_recipe_id'  => $recipe_id,
		);

		$update_format = array(
			'%d',
			'%s',
		);

		$where_format = array(
			'%d',
			'%d',
			'%d',
		);

		if ( null !== $trigger_log_id && is_int( $trigger_log_id ) ) {
			$where['ID']    = absint( $trigger_log_id );
			$where_format[] = '%d';
		}

		if ( null !== $recipe_log_id && is_int( $recipe_log_id ) ) {
			$where['automator_recipe_log_id'] = absint( $recipe_log_id );
			$where_format[]                   = '%d';
		}

		return $this->update( $update, $where, $update_format, $where_format );
	}