$userform = new user_edit_form(null, compact('user','course','authplugin'));
- $userform->set_upload_manager(new upload_manager('imagefile',false,false,null,false,0,true,true));
- $userform->set_data($user);
+ if ($user->username == 'changeme') {
+ $changeme = new object();
+ $changeme->id = $user->id;
+ $changeme->auth = $user->auth;
+ $userform->set_data($changeme);
+ } else {
+ $userform->set_data($user);
+ }
/// If data submitted, then process and store.
if ($usernew = $userform->get_data()) {
$usernew->$key = addslashes(clean_text(stripslashes(trim($usernew->$key)), FORMAT_MOODLE));
}
- $usernew->firstname = strip_tags($usernew->firstname);
- $usernew->lastname = strip_tags($usernew->lastname);
-
if (isset($usernew->username)) {
$usernew->username = moodle_strtolower($usernew->username);
}
$userupdate = has_capability('moodle/user:update', $systemcontext);
$strrequired = get_string('required');
+ $this->set_upload_manager(new upload_manager('imagefile',false,false,null,false,0,true,true));
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$newpasswordgrp[] = &MoodleQuickForm::createElement('text', 'newpassword', '', 'size="20"');
$newpasswordgrp[] = &MoodleQuickForm::createElement('static', 'newpasswordtext', '', '('.get_string('leavetokeep').')');
$mform->addGroup($newpasswordgrp, 'newpasswordgrp', get_string('newpassword'),' ',false);
- $mform->setType('newpassword', PARAM_MULTILANG);
+ $mform->setType('newpassword', PARAM_RAW);
if (!$adminself and $userauth->can_change_password()) {
if (get_user_preferences('auth_forcepasswordchange', NULL, $user->id)) {
$mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"');
- $mform->setType('firstname', PARAM_MULTILANG);
+ $mform->setType('firstname', PARAM_NOTAGS);
$mform->addRule('firstname', $strrequired, 'required', null, 'client');
$mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"');
- $mform->setType('lastname', PARAM_MULTILANG);
+ $mform->setType('lastname', PARAM_NOTAGS);
$mform->addRule('lastname', $strrequired, 'required', null, 'client');
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
$choices = get_list_of_countries();
+ $choices[0] = get_string('selectacountry').'...';
$mform->addElement('select', 'country', get_string('selectacountry'), $choices);
$mform->setType('country', PARAM_ALPHA);
$mform->addRule('country', $strrequired, 'required', null, 'client');
- if ($CFG->country) {
+ if (!empty($CFG->country)) {
$mform->setDefault('country', $CFG->country);
}
} else {
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
$mform->setType('timezone', PARAM_PATH);
+ $mform->setDefault('timezone', '99');
}
$choices = array();