// Get all the possible users
$users = array();
- $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC');
+ // Define limitfrom and limitnum for queries below
+ // If $showusers is enabled... don't apply limitfrom and limitnum
+ $limitfrom = empty($showusers) ? 0 : '';
+ $limitnum = empty($showusers) ? COURSE_MAX_USERS_PER_DROPDOWN + 1 : '';
+
+ $courseusers = get_enrolled_users($context, '', $selectedgroup, 'u.id, u.firstname, u.lastname', 'lastname ASC, firstname ASC', $limitfrom, $limitnum);
if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {
$showusers = 1;
//course-report-log-live not included as theres no blocks on the live log page
);
return $array;
-}
\ No newline at end of file
+}