Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sensei: get all the users who have completed a specific course
/**
* 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 );
}
@ChristianGiupponi

This comment has been minimized.

Copy link

commented Sep 22, 2016

This code just return comment object and all get_user_by return false

@madhumitajha

This comment has been minimized.

Copy link

commented Aug 6, 2019

How to implement date for the course started and when it was completed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.