Courses::getUserCourseProgress( $courseId = null,  $userId = null )

Get user’s course progress

Description

Source

File: bp-integrations/learndash/buddypress/Courses.php

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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

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.