wpc_has_done( int $post_id, array $tracking)

wpc_has_done( $post_id, $tracking )

Checks if a lesson has been completed or viewed by logged in user against passed $tracking array.

Return

(bool) true if lesson is in passed $tracking, false if it is not.

Parameters

$post_id (int) lesson ID

$tracking (int) tracking array

Usage

// check if user has VIEWED a lesson with ID 431

if(is_user_logged_in()){

	$user_id = get_current_user_id();

	$viewed_lessons = get_user_meta($user_id, 'wpc-lesson-tracking', true);

	$status = wpc_has_done(431, $viewed_lessons);

}

// check if user has COMPLETED a lesson with ID 431

if(is_user_logged_in()){

	$user_id = get_current_user_id();

	$viewed_lessons = get_user_meta($user_id, 'wpc-completed-lesson-tracking', true);

	$status = wpc_has_done(431, $viewed_lessons);

}