Merge branch 'MDL-60812-master' of https://github.com/mwehr/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 22 Jan 2018 15:33:07 +0000 (16:33 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 22 Jan 2018 15:33:07 +0000 (16:33 +0100)
enrol/manual/classes/enrol_users_form.php

index c34d9b2..dcb5f29 100644 (file)
@@ -123,9 +123,7 @@ class enrol_manual_enrol_users_form extends moodleform {
 
         $roles = get_assignable_roles($context);
         $mform->addElement('select', 'roletoassign', get_string('assignrole', 'enrol_manual'), $roles);
-        $keys = array_keys($roles);
-        $defaultrole = end($keys);
-        $mform->setDefault('roletoassign', $defaultrole);
+        $mform->setDefault('roletoassign', $instance->roleid);
 
         $mform->addAdvancedStatusElement('main');