Reports::showReportCourseStats()
Output report course stats html
Description
Source
File: bp-integrations/learndash/buddypress/Reports.php
public function showReportCourseStats() { if (! empty($_GET['user']) || empty($_GET['course'])) { return; } $course = get_post($_GET['course']); $group = groups_get_current_group(); $ldGroupId = bp_ld_sync('buddypress')->helpers->getLearndashGroupId($group->id); $ldGroup = get_post($ldGroupId); $ldGroupUsers = learndash_get_groups_users($ldGroupId); $ldGroupUsersCompleted = array_filter($ldGroupUsers, function($user) use ($course) { return learndash_course_completed($user->ID, $course->ID); }); $courseHasPoints = !! $coursePoints = get_post_meta($course->ID, 'course_points', true); $averagePoints = $courseHasPoints? count($ldGroupUsersCompleted) * $coursePoints : 0; require bp_locate_template('groups/single/reports-course-stats.php', false, false); }
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.