Skip to content

Commit

Permalink
MDL-51586 enrol: Enrolment table displays fullname properly.
Browse files Browse the repository at this point in the history
When the alternatefullnamedisplay was set to something that
didn't contain 'firstname' then nothing would be displayed
for the user's name.
  • Loading branch information
John Okely committed Oct 9, 2015
1 parent 74fad2c commit d5994d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions enrol/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1102,13 +1102,14 @@ public function get_users_for_display(course_enrolment_manager $manager, $sort,
*/
private function prepare_user_for_display($user, $extrafields, $now) {
$details = array(
'userid' => $user->id,
'courseid' => $this->get_course()->id,
'picture' => new user_picture($user),
'firstname' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
'lastaccess' => get_string('never'),
'lastcourseaccess' => get_string('never'),
'userid' => $user->id,
'courseid' => $this->get_course()->id,
'picture' => new user_picture($user),
'userfullnamedisplay' => fullname($user, has_capability('moodle/site:viewfullnames', $this->get_context())),
'lastaccess' => get_string('never'),
'lastcourseaccess' => get_string('never'),
);

foreach ($extrafields as $field) {
$details[$field] = $user->{$field};
}
Expand Down
1 change: 1 addition & 0 deletions enrol/otherusers.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

$userdetails = array (
'picture' => false,
'userfullnamedisplay' => false,
'firstname' => get_string('firstname'),
'lastname' => get_string('lastname'),
);
Expand Down
2 changes: 1 addition & 1 deletion enrol/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@


$renderer = $PAGE->get_renderer('core_enrol');
$userdetails = array('picture' => false);
$userdetails = array('picture' => false, 'userfullnamedisplay' => false);
// Get all the user names in a reasonable default order.
$allusernames = get_all_user_name_fields(false, null, null, null, true);
// Initialise the variable for the user's names in the table header.
Expand Down

0 comments on commit d5994d3

Please sign in to comment.