From 9b132c5b234b11c32052f3a0ba42c11006c11de7 Mon Sep 17 00:00:00 2001 From: John Okely Date: Thu, 8 Oct 2015 14:56:44 +0800 Subject: [PATCH] MDL-51586 enrol: Enrolment table displays fullname properly. When the alternatefullnamedisplay was set to something that didn't contain 'firstname' then nothing would be displayed for the user's name. --- enrol/locallib.php | 13 +++++++------ enrol/otherusers.php | 1 + enrol/users.php | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/enrol/locallib.php b/enrol/locallib.php index 7ab3e3d41e8..bb5d1cd2a98 100644 --- a/enrol/locallib.php +++ b/enrol/locallib.php @@ -1091,13 +1091,14 @@ class course_enrolment_manager { */ 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())), - 'lastseen' => 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())), + 'lastseen' => get_string('never'), + 'lastcourseaccess' => get_string('never'), ); + foreach ($extrafields as $field) { $details[$field] = $user->{$field}; } diff --git a/enrol/otherusers.php b/enrol/otherusers.php index 50c2bcb2e2e..4351c3cf5a6 100644 --- a/enrol/otherusers.php +++ b/enrol/otherusers.php @@ -50,6 +50,7 @@ navigation_node::override_active_url(new moodle_url('/enrol/otherusers.php', arr $userdetails = array ( 'picture' => false, + 'userfullnamedisplay' => false, 'firstname' => get_string('firstname'), 'lastname' => get_string('lastname'), ); diff --git a/enrol/users.php b/enrol/users.php index 8f83c267099..8a71a25d4d8 100644 --- a/enrol/users.php +++ b/enrol/users.php @@ -174,7 +174,7 @@ if ($action) { $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.