// Print the required moodle fields first.
$mform->addElement('header', 'moodle', $strgeneral);
- $mform->addElement('text', 'username', get_string('username'), 'size="20"');
- $mform->addRule('username', $strrequired, 'required', null, 'client');
- $mform->setType('username', core_user::get_property_type('username'));
-
$auths = core_component::get_plugin_list('auth');
$enabled = get_string('pluginenabled', 'core_plugin');
$disabled = get_string('plugindisabled', 'core_plugin');
$authoptions = array($enabled => array(), $disabled => array());
$cannotchangepass = array();
+ $cannotchangeusername = array();
foreach ($auths as $auth => $unused) {
$authinst = get_auth_plugin($auth);
+
+ if (!$authinst->is_internal()) {
+ $cannotchangeusername[] = $auth;
+ }
+
$passwordurl = $authinst->change_password_url();
if (!($authinst->can_change_password() && empty($passwordurl))) {
if ($userid < 1 and $authinst->is_internal()) {
$authoptions[$disabled][$auth] = get_string('pluginname', "auth_{$auth}");
}
}
+
+ $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);
+
$mform->addElement('selectgroups', 'auth', get_string('chooseauthmethod', 'auth'), $authoptions);
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');