Courses::getUserCourseProgress( $courseId = null, $userId = null )
Get user’s course progress
Description
Source
File: bp-integrations/learndash/buddypress/Courses.php
public function getUserCourseProgress($courseId = null, $userId = null)
{
if (! $courseId) {
$courseId = get_the_ID();
}
if (! $userId) {
$userId = bp_loggedin_user_id();
}
$totalSteps = learndash_get_course_steps_count($courseId);
if ($totalSteps == 0) {
return 0;
}
$userSteps = learndash_course_get_completed_steps($userId, $courseId);
return round($userSteps / $totalSteps * 100);
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.