Reports::getGroupCoursesList()

Get group’s course list for filter

Description

Source

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

487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
protected function getGroupCoursesList() {
    $ldGroupId = bp_ld_sync( 'buddypress' )->helpers->getLearndashGroupId( groups_get_current_group()->id );
    $courseIds = learndash_group_enrolled_courses( $ldGroupId );
 
    /**
     * Filter to update course lists
     */
    $courses = array_map( 'get_post', apply_filters( 'bp_ld_learndash_group_enrolled_courses', $courseIds, $ldGroupId ) );
 
    array_unshift( $courses, (object) [
        'ID'         => '',
        'post_title' => __( 'All Courses', 'buddyboss' )
    ] );
 
    return wp_list_pluck( $courses, 'post_title', 'ID' );
}

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.