From 122c999536ea354353d85bf1889cb90bec2b4198 Mon Sep 17 00:00:00 2001 From: wehr Date: Fri, 12 Jan 2018 16:13:27 +0100 Subject: [PATCH] MDL-60812 enrol_manual: Fixes not working default role --- enrol/manual/classes/enrol_users_form.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/enrol/manual/classes/enrol_users_form.php b/enrol/manual/classes/enrol_users_form.php index c34d9b27cea..dcb5f2996aa 100644 --- a/enrol/manual/classes/enrol_users_form.php +++ b/enrol/manual/classes/enrol_users_form.php @@ -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');