Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'w07_MDL-25778_20_defaultcity' of git://github.com/skoda…

…k/moodle
  • Loading branch information...
commit 2623f6bef2023458da31469460acdc50f926bcfe 2 parents 2453531 + fa7f750
@stronk7 stronk7 authored
View
1  admin/settings/location.php
@@ -10,6 +10,7 @@
$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'));
View
4 admin/uploaduser.php
@@ -572,6 +572,10 @@
$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';
}
View
4 auth/db/auth.php
@@ -358,6 +358,10 @@ function sync_users($do_updates=false) {
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
View
8 auth/ldap/auth.php
@@ -490,6 +490,10 @@ function user_signup($user, $notify=true) {
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 @@ function sync_users($do_updates=true) {
$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)) {
View
2  lang/en/admin.php
@@ -429,6 +429,8 @@
$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}';
View
3  login/signup_form.php
@@ -79,6 +79,9 @@ function definition() {
$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');
View
4 user/editlib.php
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.