Get users who have completed a course

Please note that this is a Developer level document. If you are unfamiliar with code/templates and resolving potential conflicts, select a WooExpert or Developer for assistance. We are unable to provide support for customizations under our Support Policy.

/**
* Get the list of users who have completed a specific course:
*/
// Course ID can be found in the URL when you edit the course
$course_id = '2607';
$activity_args = array(
'post_id' => $course_id,
'type' => 'sensei_course_status',
'status' => 'complete',
);
// run WP_Comment_Query to get the activity on the course
$user_statusses = WooThemes_Sensei_Utils::sensei_check_for_activity( $activity_args, true );
//Now get all the users
$users = array();
foreach( $user_statusses as $activity ){
$users[] = get_user_by( 'id', $activity->user_id );
}

view raw
gistfile1.php
hosted with ❤ by GitHub