Commit d636015c authored by Shamim Rezaie's avatar Shamim Rezaie
Browse files

MDL-55915 enrol_manual: let fullname()know if user has viewfullnames cap

fullname() relies on its second parameter to determine wheter it should use fullnamedisplay or alternativefullnameformat.
We need to check for moodle/site:viewfullnames capability and pass true as the second parameter to fullname() whereever
the user has this capability.
parent ee8f39b7
......@@ -80,9 +80,10 @@ switch ($action) {
} else {
$useroptions['link'] = false;
}
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
foreach ($outcome->response['users'] as &$user) {
$user->picture = $OUTPUT->user_picture($user, $useroptions);
$user->fullname = fullname($user);
$user->fullname = fullname($user, $viewfullnames);
$fieldvalues = array();
foreach ($extrafields as $field) {
$fieldvalues[] = s($user->{$field});
......
......@@ -37,6 +37,7 @@ $context = context_course::instance($course->id, MUST_EXIST);
require_login($course);
$canenrol = has_capability('enrol/manual:enrol', $context);
$canunenrol = has_capability('enrol/manual:unenrol', $context);
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
// Note: manage capability not used here because it is used for editing
// of existing enrolments which is not possible here.
......@@ -74,7 +75,9 @@ navigation_node::override_active_url(new moodle_url('/enrol/users.php', array('i
$options = array('enrolid' => $enrolid, 'accesscontext' => $context);
$potentialuserselector = new enrol_manual_potential_participant('addselect', $options);
$potentialuserselector->viewfullnames = $viewfullnames;
$currentuserselector = new enrol_manual_current_participant('removeselect', $options);
$currentuserselector->viewfullnames = $viewfullnames;
// Build the list of options for the enrolment period dropdown.
$unlimitedperiod = get_string('unlimited');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment