mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
Merge branch 'w07_MDL-25778_20_defaultcity' of git://github.com/skodak/moodle
This commit is contained in:
commit
2623f6bef2
@ -10,6 +10,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$options[99] = get_string('timezonenotforced', 'admin');
|
||||
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
|
||||
$temp->add(new admin_settings_country_select('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtext('defaultcity', get_string('defaultcity', 'admin'), get_string('defaultcity_help', 'admin'), ''));
|
||||
|
||||
$temp->add(new admin_setting_heading('iplookup', get_string('iplookup', 'admin'), get_string('iplookupinfo', 'admin')));
|
||||
$temp->add(new admin_setting_configfile('geoipfile', get_string('geoipfile', 'admin'), get_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLiteCity.dat'));
|
||||
|
@ -572,6 +572,10 @@ if ($formdata = $mform->is_cancelled()) {
|
||||
$user->timemodified = time();
|
||||
$user->timecreated = time();
|
||||
|
||||
if (!empty($CFG->defaultcity) and !property_exists($user, 'city')) {
|
||||
$user->city = $CFG->defaultcity;
|
||||
}
|
||||
|
||||
if (isset($user->auth) && empty($user->auth)) {
|
||||
$user->auth = 'manual';
|
||||
}
|
||||
|
@ -358,6 +358,10 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
echo "\t"; print_string('auth_dbreviveduser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); echo "\n";
|
||||
|
||||
} else {
|
||||
if (!empty($CFG->defaultcity) and !property_exists($user, 'city')) {
|
||||
$user->city = $CFG->defaultcity;
|
||||
}
|
||||
|
||||
$id = $DB->insert_record ('user',$user); // it is truly a new user
|
||||
echo "\t"; print_string('auth_dbinsertuser','auth_db',array('name'=>$user->username, 'id'=>$id)); echo "\n";
|
||||
// if relevant, tag for password generation
|
||||
|
@ -490,6 +490,10 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
print_error('auth_ldap_create_error', 'auth_ldap');
|
||||
}
|
||||
|
||||
if (!empty($CFG->defaultcity) and !property_exists($user, 'city')) {
|
||||
$user->city = $CFG->defaultcity;
|
||||
}
|
||||
|
||||
$user->id = $DB->insert_record('user', $user);
|
||||
|
||||
// Save any custom profile field information
|
||||
@ -849,6 +853,10 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user->lang = $CFG->lang;
|
||||
}
|
||||
|
||||
if (!empty($CFG->defaultcity) and !property_exists($user, 'city')) {
|
||||
$user->city = $CFG->defaultcity;
|
||||
}
|
||||
|
||||
$id = $DB->insert_record('user', $user);
|
||||
echo "\t"; print_string('auth_dbinsertuser', 'auth_db', array('name'=>$user->username, 'id'=>$id)); echo "\n";
|
||||
if (!empty($this->config->forcechangepassword)) {
|
||||
|
@ -429,6 +429,8 @@ $string['debugsmtp'] = 'Debug email sending';
|
||||
$string['debugstringids'] = 'Show origin of languages strings';
|
||||
$string['debugvalidators'] = 'Show validator links';
|
||||
$string['defaultallowedmodules'] = 'Default allowed modules';
|
||||
$string['defaultcity'] = 'Default city';
|
||||
$string['defaultcity_help'] = 'A city entered here will be the default city when creating new user accounts.';
|
||||
$string['defaulthomepage'] = 'Default home page for users';
|
||||
$string['defaultrequestcategory'] = 'Default category for course requests';
|
||||
$string['defaultsettinginfo'] = 'Default: {$a}';
|
||||
|
@ -79,6 +79,9 @@ class login_signup_form extends moodleform {
|
||||
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="20"');
|
||||
$mform->setType('city', PARAM_TEXT);
|
||||
$mform->addRule('city', get_string('missingcity'), 'required', null, 'server');
|
||||
if (!empty($CFG->defaultcity)) {
|
||||
$mform->setDefault('city', $CFG->defaultcity);
|
||||
}
|
||||
|
||||
$country = get_string_manager()->get_list_of_countries();
|
||||
$default_country[''] = get_string('selectacountry');
|
||||
|
@ -194,7 +194,9 @@ function useredit_shared_definition(&$mform, $editoroptions = null) {
|
||||
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
|
||||
$mform->setType('city', PARAM_MULTILANG);
|
||||
$mform->addRule('city', $strrequired, 'required', null, 'client');
|
||||
|
||||
if (!empty($CFG->defaultcity)) {
|
||||
$mform->setDefault('city', $CFG->defaultcity);
|
||||
}
|
||||
|
||||
$choices = get_string_manager()->get_list_of_countries();
|
||||
$choices= array(''=>get_string('selectacountry').'...') + $choices;
|
||||
|
Loading…
x
Reference in New Issue
Block a user