From 4d83abd05222bbd0ff97ead9199f31c9eb5a5cd0 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Thu, 3 Oct 2013 10:25:27 +0800 Subject: [PATCH] MDL-42089 - Administration: Update to sql to include alternate name fields. --- admin/roles/assign.php | 3 ++- lib/adminlib.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/admin/roles/assign.php b/admin/roles/assign.php index cce23341f3d..b5778585282 100644 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -255,7 +255,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 857d3d1dd21..e556c5e81b6 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -3329,8 +3329,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)),