Skip to content

Commit

Permalink
MDL-49742 lib: Removed additional names on tables for sorting.
Browse files Browse the repository at this point in the history
When additional names are disabled, they are no longer shown as
sortable headings in the enrolment and admin user tables.
  • Loading branch information
abgreeve committed May 15, 2015
1 parent b5dbb12 commit 1fc2bb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions admin/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 7 additions & 2 deletions enrol/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,14 @@
$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);
Expand Down

0 comments on commit 1fc2bb3

Please sign in to comment.