* @package core_user
*/
+require_once($CFG->dirroot . '/user/lib.php');
+
/**
* Cancels the requirement for a user to update their email address.
*
// Add the necessary names.
foreach (useredit_get_required_name_fields() as $fullname) {
- $mform->addElement('text', $fullname, get_string($fullname), 'maxlength="100" size="30"');
+ $purpose = user_edit_map_field_purpose($user->id, $fullname);
+ $mform->addElement('text', $fullname, get_string($fullname), 'maxlength="100" size="30"' . $purpose);
if ($stringman->string_exists('missing'.$fullname, 'core')) {
$strmissingfield = get_string('missing'.$fullname, 'core');
} else {
$enabledusernamefields = useredit_get_enabled_name_fields();
// Add the enabled additional name fields.
foreach ($enabledusernamefields as $addname) {
- $mform->addElement('text', $addname, get_string($addname), 'maxlength="100" size="30"');
+ $purpose = user_edit_map_field_purpose($user->id, $addname);
+ $mform->addElement('text', $addname, get_string($addname), 'maxlength="100" size="30"' . $purpose);
$mform->setType($addname, PARAM_NOTAGS);
}
. get_string('emailchangecancel', 'auth') . '</a>';
$mform->addElement('static', 'emailpending', get_string('email'), $notice);
} else {
- $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
+ $purpose = user_edit_map_field_purpose($user->id, 'email');
+ $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"' . $purpose);
$mform->addRule('email', $strrequired, 'required', null, 'client');
$mform->setType('email', PARAM_RAW_TRIMMED);
}
$mform->setDefault('maildisplay', core_user::get_property_default('maildisplay'));
$mform->addHelpButton('maildisplay', 'emaildisplay');
+ $mform->addElement('text', 'moodlenetprofile', get_string('moodlenetprofile', 'user'));
+ $mform->setType('moodlenetprofile', PARAM_NOTAGS);
+ $mform->addHelpButton('moodlenetprofile', 'moodlenetprofile', 'user');
+
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
$mform->setType('city', PARAM_TEXT);
if (!empty($CFG->defaultcity)) {
$mform->setDefault('city', $CFG->defaultcity);
}
+ $purpose = user_edit_map_field_purpose($user->id, 'country');
$choices = get_string_manager()->get_list_of_countries();
$choices = array('' => get_string('selectacountry') . '...') + $choices;
- $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
+ $mform->addElement('select', 'country', get_string('selectacountry'), $choices, $purpose);
if (!empty($CFG->country)) {
$mform->setDefault('country', core_user::get_property_default('country'));
}
$mform->addElement('select', 'timezone', get_string('timezone'), $choices);
}
+ if ($user->id < 0) {
+ $purpose = user_edit_map_field_purpose($user->id, 'lang');
+ $translations = get_string_manager()->get_list_of_translations();
+ $mform->addElement('select', 'lang', get_string('preferredlanguage'), $translations, $purpose);
+ $lang = empty($user->lang) ? $CFG->lang : $user->lang;
+ $mform->setDefault('lang', $lang);
+ }
+
if (!empty($CFG->allowuserthemes)) {
$choices = array();
$choices[''] = get_string('default');
if (count($disabledusernamefields) > 0) {
$mform->addElement('header', 'moodle_additional_names', get_string('additionalnames'));
foreach ($disabledusernamefields as $allname) {
- $mform->addElement('text', $allname, get_string($allname), 'maxlength="100" size="30"');
+ $purpose = user_edit_map_field_purpose($user->id, $allname);
+ $mform->addElement('text', $allname, get_string($allname), 'maxlength="100" size="30"' . $purpose);
$mform->setType($allname, PARAM_NOTAGS);
}
}