Reports::getGroupCoursesList()

Get group’s course list for filter

Description

Source

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

	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.