From 1fc2bb35e68127f0fc8a660e10de87771cf59717 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Mon, 11 May 2015 10:17:29 +0800 Subject: [PATCH] MDL-49742 lib: Removed additional names on tables for sorting. When additional names are disabled, they are no longer shown as sortable headings in the enrolment and admin user tables. --- admin/user.php | 9 +++++++-- enrol/users.php | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/admin/user.php b/admin/user.php index 88e37a48b94..b05838c9985 100644 --- a/admin/user.php +++ b/admin/user.php @@ -190,9 +190,14 @@ // We don't need to check the fullnamedisplay setting here as the fullname function call further down has // the override parameter set to true. $fullnamesetting = $CFG->alternativefullnameformat; - // If we are using language or it is empty, then retrieve all of the user's names. + // If we are using language or it is empty, then retrieve the default user names of just 'firstname' and 'lastname'. if ($fullnamesetting == 'language' || empty($fullnamesetting)) { - $fullnamesetting = implode(' ', $allusernamefields); + // Set $a variables to return 'firstname' and 'lastname'. + $a = new stdClass(); + $a->firstname = 'firstname'; + $a->lastname = 'lastname'; + // Getting the fullname display will ensure that the order in the language file is maintained. + $fullnamesetting = get_string('fullnamedisplay', null, $a); } // Order in string will ensure that the name columns are in the correct order. diff --git a/enrol/users.php b/enrol/users.php index f779bed6bc5..51d4a4e2bc1 100644 --- a/enrol/users.php +++ b/enrol/users.php @@ -187,9 +187,14 @@ $allusernames = get_all_user_name_fields(false, null, null, null, true); $usernameheader = null; // Get the alternative full name format for users with the viewfullnames capability. $fullusernames = $CFG->alternativefullnameformat; -// If fullusernames is empty or accidentally set to language then fall back on the $allusernames set up. +// If fullusernames is empty or accidentally set to language then fall back to default of just first and last name. if ($fullusernames == 'language' || empty($fullusernames)) { - $usernameheader = $allusernames; + // Set $a variables to return 'firstname' and 'lastname'. + $a = new stdClass(); + $a->firstname = 'firstname'; + $a->lastname = 'lastname'; + // Getting the fullname display will ensure that the order in the language file is maintained. + $usernameheader = explode(' ', get_string('fullnamedisplay', null, $a)); } else { // If everything is as expected then put them in the order specified by the alternative full name format setting. $usernameheader = order_in_string($allusernames, $fullusernames);