MDL-35104 auth: Always allow editing username for new users
authorCameron Ball <cameron@moodle.com>
Wed, 22 Jun 2016 05:59:39 +0000 (13:59 +0800)
committerCameron Ball <cameron@moodle.com>
Wed, 22 Jun 2016 05:59:39 +0000 (13:59 +0800)
user/editadvanced_form.php

index 69a9e25..57f7e7d 100644 (file)
@@ -99,7 +99,10 @@ class user_editadvanced_form extends moodleform {
         $mform->addElement('text', 'username', get_string('username'), 'size="20"');
         $mform->addHelpButton('username', 'username', 'auth');
         $mform->setType('username', core_user::get_property_type('username'));
-        $mform->disabledIf('username', 'auth', 'in', $cannotchangeusername);
+
+        if ($userid !== -1) {
+            $mform->disabledIf('username', 'auth', 'in', $cannotchangeusername);
+        }
 
         $mform->addElement('selectgroups', 'auth', get_string('chooseauthmethod', 'auth'), $authoptions);
         $mform->addHelpButton('auth', 'chooseauthmethod', 'auth');