mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
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.
This commit is contained in:
parent
ee8f39b7a2
commit
d636015c8a
@ -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');
|
||||
|
Loading…
x
Reference in New Issue
Block a user