Sensei: get all the users who have completed a specific course
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); | |
} |
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
This code just return comment object and all
get_user_by
return false