Skip to content

Commit

Permalink
Merge branch 'MDL-59365-master-fix2' of http://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 13, 2017
2 parents e45c3ae + af6d238 commit f6a7d54
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion enrol/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,13 @@ public static function get_potential_users($courseid, $enrolid, $search, $search
$params['perpage']);

$results = array();
$requiredfields = ['id', 'fullname', 'profileimageurl', 'profileimageurlsmall'];
foreach ($users['users'] as $id => $user) {
// Note: We pass the course here to validate that the current user can at least view user details in this course.
// The user we are looking at is not in this course yet though - but we only fetch the minimal set of
// user records, and the user has been validated to have course:enrolreview in this course. Otherwise
// there is no way to find users who aren't in the course in order to enrol them.
if ($userdetails = user_get_user_details($user, $course)) {
if ($userdetails = user_get_user_details($user, $course, $requiredfields)) {
$results[] = $userdetails;
}
}
Expand Down
2 changes: 1 addition & 1 deletion enrol/manual/ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}
}

$roleid = optional_param('role', null, PARAM_INT);
$roleid = optional_param('roletoassign', null, PARAM_INT);
$duration = optional_param('duration', 0, PARAM_FLOAT);
$startdate = optional_param('startdate', 0, PARAM_INT);
$recovergrades = optional_param('recovergrades', 0, PARAM_INT);
Expand Down
4 changes: 2 additions & 2 deletions enrol/manual/classes/enrol_users_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ public function definition() {
$mform->addElement('cohort', 'cohortlist', get_string('selectcohorts', 'enrol_manual'), $options);

$roles = get_assignable_roles($context);
$mform->addElement('select', 'role', get_string('assignrole', 'enrol_manual'), $roles);
$mform->addElement('select', 'roletoassign', get_string('assignrole', 'enrol_manual'), $roles);
$keys = array_keys($roles);
$defaultrole = end($keys);
$mform->setDefault('role', $defaultrole);
$mform->setDefault('roletoassign', $defaultrole);

$mform->addAdvancedStatusElement('main');

Expand Down
2 changes: 1 addition & 1 deletion enrol/tests/behat/behat_enrol.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function i_enrol_user_as($userfullname, $rolename) {
$this->execute("behat_forms::press_button", get_string('enrolusers', 'enrol'));

if ($this->running_javascript()) {
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignroles', 'enrol_manual'), $rolename));
$this->execute('behat_forms::i_set_the_field_to', array(get_string('assignrole', 'enrol_manual'), $rolename));

// We have a div here, not a tr.
$this->execute('behat_forms::i_set_the_field_to', array(get_string('selectusers', 'enrol_manual'), $userfullname));
Expand Down

0 comments on commit f6a7d54

Please sign in to comment.