diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index 5337ee04bd..b50b687b65 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -6500,9 +6500,8 @@ class SessionManager ) { $userId = api_get_user_id(); $drhLoaded = false; - $drhCanAccessAllStudents = (api_drh_can_access_all_session_content() || api_get_configuration_value('drh_allow_access_to_all_students')); if (api_is_drh()) { - if ($drhCanAccessAllStudents) { + if (api_drh_can_access_all_session_content()) { $count = self::getAllUsersFromCoursesFromAllSessionFromStatus( 'drh_all', $userId, @@ -6520,6 +6519,11 @@ class SessionManager ); $drhLoaded = true; } + $allowDhrAccessToAllStudents = api_get_configuration_value('drh_allow_access_to_all_students'); + if ($allowDhrAccessToAllStudents) { + $count = count(UserManager::get_user_list(['status' => STUDENT])); + $drhLoaded = true; + } } $checkSessionVisibility = api_get_configuration_value('show_users_in_active_sessions_in_tracking'); diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 48533936f2..adc6eadb11 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -2245,21 +2245,7 @@ class Tracking ); } else { if (api_is_drh() && $allowDhrAccessToAllStudents) { - $studentList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus( - 'drh_all', - $userId, - false, - null, - null, - null, - null, - null, - null, - null, - [], - [], - STUDENT - ); + $studentList = UserManager::get_user_list(['status' => STUDENT]); } else { $studentList = UserManager::getUsersFollowedByUser( $userId, diff --git a/main/mySpace/student.php b/main/mySpace/student.php index c735cebd70..938212ce8f 100755 --- a/main/mySpace/student.php +++ b/main/mySpace/student.php @@ -73,8 +73,7 @@ function get_users($from, $limit, $column, $direction): array $students = []; if (api_is_drh()) { - $allowDhrAccessToAllStudents = api_get_configuration_value('drh_allow_access_to_all_students'); - if (api_drh_can_access_all_session_content() || $allowDhrAccessToAllStudents) { + if (api_drh_can_access_all_session_content()) { $students = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus( 'drh_all', api_get_user_id(), @@ -92,6 +91,11 @@ function get_users($from, $limit, $column, $direction): array ); $drhLoaded = true; } + $allowDhrAccessToAllStudents = api_get_configuration_value('drh_allow_access_to_all_students'); + if ($allowDhrAccessToAllStudents) { + $students = UserManager::get_user_list(['status' => STUDENT]); + $drhLoaded = true; + } } $checkSessionVisibility = api_get_configuration_value('show_users_in_active_sessions_in_tracking'); diff --git a/main/mySpace/users.php b/main/mySpace/users.php index ef02b156f3..1fc22f64b1 100755 --- a/main/mySpace/users.php +++ b/main/mySpace/users.php @@ -83,10 +83,9 @@ function get_users($from, $limit, $column, $direction) $is_western_name_order = api_is_western_name_order(); $coach_id = api_get_user_id(); $drhLoaded = false; - $drhCanAccessAllStudents = (api_drh_can_access_all_session_content() || api_get_configuration_value('drh_allow_access_to_all_students')); if (api_is_drh()) { - if ($drhCanAccessAllStudents) { + if (api_drh_can_access_all_session_content()) { $students = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus( 'drh_all', api_get_user_id(), @@ -104,6 +103,11 @@ function get_users($from, $limit, $column, $direction) ); $drhLoaded = true; } + $allowDhrAccessToAllStudents = api_get_configuration_value('drh_allow_access_to_all_students'); + if ($allowDhrAccessToAllStudents) { + $students = UserManager::get_user_list(['status' => STUDENT]); + $drhLoaded = true; + } } if (false === $drhLoaded) {