Courses::getGroupCourseProgress( $courseId = null )
Get gorup’s course progress
Description
Source
File: bp-integrations/learndash/buddypress/Courses.php
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | public function getGroupCourseProgress( $courseId = null) { if (! $courseId ) { $courseId = get_the_ID(); } $members = groups_get_group_members(); $totalSteps = learndash_get_course_steps_count( $courseId ); if ( $members [ 'count' ] == 0) { return 0; } if ( $totalSteps == 0) { return 0; } $totalSteps = learndash_get_course_steps_count( $courseId ); $memberSteps = array_sum ( array_map ( function ( $member ) use ( $courseId ) { return learndash_course_get_completed_steps( $member ->id, $courseId ); }, $members [ 'members' ])); return round ( $memberSteps / ( $members [ 'count' ] * $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.