Skip to content

Commit

Permalink
PROD-8027: Updated change to support deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
surajkrsingh committed Jan 6, 2025
1 parent 5e53b57 commit 4cdaf3f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/bp-core/profile-search/bps-xprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,21 +584,26 @@ function bp_ps_learndash_get_users_for_course( $course_id = 0, $query_args = arr
}

if ( true === learndash_use_legacy_course_access_list() ) {
$course_access_list = learndash_get_course_meta_setting( $course_id, 'course_access_list' );
$course_access_list = function_exists( 'learndash_get_course_meta_setting' ) ? learndash_get_course_meta_setting( $course_id, 'course_access_list' ) : get_course_meta_setting( $course_id, 'course_access_list' );
$course_user_ids = array_merge( $course_user_ids, $course_access_list );
}

$course_access_users = learndash_get_course_users_access_from_meta( $course_id );
$course_access_users = function_exists( 'learndash_get_course_users_access_from_meta' ) ? learndash_get_course_users_access_from_meta( $course_id ) : get_course_users_access_from_meta( $course_id );
$course_user_ids = array_merge( $course_user_ids, $course_access_users );

$course_groups_users = learndash_get_course_groups_users_access( $course_id );
$course_user_ids = array_merge( $course_user_ids, $course_groups_users );
if ( function_exists( 'learndash_get_course_groups_users_access' ) ) {
$course_groups_users = learndash_get_course_groups_users_access( $course_id );
} else {
$course_groups_users = get_course_groups_users_access( $course_id );
}

$course_user_ids = array_merge( $course_user_ids, $course_groups_users );

if ( ! empty( $course_user_ids ) ) {
$course_user_ids = array_unique( $course_user_ids );
}

$course_expired_access_users = learndash_get_course_expired_access_from_meta( $course_id );
$course_expired_access_users = function_exists( 'learndash_get_course_expired_access_from_meta' ) ? learndash_get_course_expired_access_from_meta( $course_id ) : get_course_expired_access_from_meta( $course_id );
if ( ! empty( $course_expired_access_users ) ) {
$course_user_ids = array_diff( $course_user_ids, $course_expired_access_users );
}
Expand Down

0 comments on commit 4cdaf3f

Please sign in to comment.