diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 6fa632ef732..980e2aea889 100644 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -266,7 +266,8 @@ if ($roleid) { foreach ($assignableroles as $roleid => $notused) { $roleusers = ''; if (0 < $assigncounts[$roleid] && $assigncounts[$roleid] <= MAX_USERS_TO_LIST_PER_ROLE) { - $roleusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname'); + $userfields = 'u.id, u.username, ' . get_all_user_name_fields(true, 'u'); + $roleusers = get_role_users($roleid, $context, false, $userfields); if (!empty($roleusers)) { $strroleusers = array(); foreach ($roleusers as $user) { diff --git a/lib/adminlib.php b/lib/adminlib.php index 380e0c765c0..5776d5bc6ed 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -3328,8 +3328,8 @@ class admin_setting_users_with_capability extends admin_setting_configmultiselec 'This is unexpected, and a problem because there is no way to pass these ' . 'parameters to get_users_by_capability. See MDL-34657.'); } - $users = get_users_by_capability(context_system::instance(), - $this->capability, 'u.id,u.username,u.firstname,u.lastname', $sort); + $userfields = 'u.id, u.username, ' . get_all_user_name_fields(true, 'u'); + $users = get_users_by_capability(context_system::instance(), $this->capability, $userfields, $sort); $this->choices = array( '$@NONE@$' => get_string('nobody'), '$@ALL@$' => get_string('everyonewhocan', 'admin', get_capability_string($this->capability)),