Skip to content

Instantly share code, notes, and snippets.

@woogist
Created June 8, 2015 04:59
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save woogist/351c62147604dd8825d3 to your computer and use it in GitHub Desktop.
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
Copy link

This code just return comment object and all get_user_by return false

@madhumitajha
Copy link

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