MDL-71131 Admin: Users page incorrectly showing all name fields
This commit is contained in:
+5
-4
@@ -183,10 +183,11 @@
|
||||
// These columns are always shown in the users list.
|
||||
$requiredcolumns = array('city', 'country', 'lastaccess');
|
||||
// Extra columns containing the extra user fields, excluding the required columns (city and country, to be specific).
|
||||
$userfields = \core_user\fields::for_identity($context, true)->with_name()->excluding(...$requiredcolumns);
|
||||
$userfields = \core_user\fields::for_identity($context, true)->excluding(...$requiredcolumns);
|
||||
$extracolumns = $userfields->get_required_fields();
|
||||
// Get all user name fields as an array.
|
||||
$columns = array_merge($extracolumns, $requiredcolumns);
|
||||
// Get all user name fields as an array, but with firstname and lastname first.
|
||||
$allusernamefields = \core_user\fields::get_name_fields(true);
|
||||
$columns = array_merge($allusernamefields, $extracolumns, $requiredcolumns);
|
||||
|
||||
foreach ($columns as $column) {
|
||||
$string[$column] = \core_user\fields::get_display_name($column);
|
||||
@@ -226,7 +227,7 @@
|
||||
}
|
||||
|
||||
// Order in string will ensure that the name columns are in the correct order.
|
||||
$usernames = order_in_string($extracolumns, $fullnamesetting);
|
||||
$usernames = order_in_string($allusernamefields, $fullnamesetting);
|
||||
$fullnamedisplay = array();
|
||||
foreach ($usernames as $name) {
|
||||
// Use the link from $$column for sorting on the user's name.
|
||||
|
||||
Reference in New Issue
Block a user