$systemcontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
$userupdate = has_capability('moodle/user:update', $systemcontext);
-
$strrequired = get_string('required');
/// Add some extra hidden fields
- $mform->addElement('hidden', 'id', $user->id);
+ $mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'course', $course->id);
$mform->setDefault('username', '');
$mform->addRule('username', $strrequired, 'required', null, 'client');
} else {
- $mform->addElement('hidden', 'username', $user->username);
+ $mform->addElement('hidden', 'username');
}
$modules = get_list_of_plugins("auth");
$newpasswordgrp[] = &MoodleQuickForm::createElement('static', 'newpasswordtext', '', '('.get_string('leavetokeep').')');
$mform->addGroup($newpasswordgrp, 'newpasswordgrp', get_string('newpassword'),' ',false);
$mform->setType('newpassword', PARAM_MULTILANG);
- if (isset($user->newpassword)) {
- $mform->setDefault('newpassword', $user->newpassword);
- }
if (!$adminself and $userauth->can_change_password()) {
if (get_user_preferences('auth_forcepasswordchange', NULL, $user->id)) {
$mform->setType('city', PARAM_MULTILANG);
$mform->addRule('city', $strrequired, 'required', null, 'client');
- if (!$user->country and $CFG->country) {
- $user->country = $CFG->country;
- }
+
$choices = get_list_of_countries();
$mform->addElement('select', 'country', get_string('selectacountry'), $choices);
$mform->setType('country', PARAM_ALPHA);
$mform->addRule('country', $strrequired, 'required', null, 'client');
+ if ($CFG->country) {
+ $mform->setDefault('country', $CFG->country);
+ }
$choices = get_list_of_timezones();
$choices['99'] = get_string('serverlocaltime');
$choices = array();
if ($choices = get_list_of_languages()) {
- if (!$user->lang) {
- $user->lang = $CFG->lang;
- }
$mform->addElement('select', 'lang', get_string('preferredlanguage'), $choices);
$mform->setType('lang', PARAM_FILE);
+ $mform->setDefault('lang', $CFG->lang);
}
if (!empty($CFG->allowuserthemes)) {
if ($userupdate) {
$fields = get_user_fieldnames();
$freezefields = array();
-
foreach ($fields as $field) {
$configvariable = 'field_lock_' . $field;
if (isset($authplugin->config->{$configvariable}) and
if ($categories = get_records_select('user_info_category', '1', 'sortorder ASC')) {
foreach ($categories as $category) {
if ($fields = get_records_select('user_info_field', "categoryid=$category->id", 'sortorder ASC')) {
-
+
$mform->addElement('header', 'category_'.$category->id, $category->name);
-
+
foreach ($fields as $field) {
require_once($CFG->dirroot.'/user/profile/field/'.$field->datatype.'/field.class.php');