Automator_Functions::user_completed_recipe_number_times( $recipe_id,  $user_id )


Parameters Parameters

$recipe_id

(Required)

$user_id

(Required)


Top ↑

Return Return

(false|int|string)


Source Source

File: src/core/lib/class-automator-functions.php

	public function user_completed_recipe_number_times( $recipe_id, $user_id ) {
		global $wpdb;
		$results = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT COUNT(completed) AS num_times_completed
						FROM {$wpdb->prefix}uap_recipe_log
						WHERE 1=1
						AND user_id = %d
						AND automator_recipe_id = %d
						AND completed = 1",
				$user_id,
				$recipe_id
			)
		);

		if ( 0 === $results ) {
			return false;
		}

		return empty( $results ) ? 0 : $results;
	}