Commit 8f44c634 authored by Richard Mansfield's avatar Richard Mansfield

Fix default country setting to make it stick

Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 317ba1e2
......@@ -44,6 +44,8 @@ $yesno = array(true => get_string('yes'),
$searchpluginoptions = get_search_plugins();
$countries = getoptions_country();
$siteoptionform = array(
'name' => 'siteoptions',
'jsform' => true,
......@@ -72,8 +74,8 @@ $siteoptionform = array(
'type' => 'select',
'title' => get_string('country', 'admin'),
'description' => get_string('sitecountrydescription', 'admin'),
'defaultvalue' => 'nz',
'options' => getoptions_country(),
'defaultvalue' => get_config('country'),
'options' => array('' => get_string('nocountryselected')) + $countries,
'help' => true,
),
'theme' => array(
......@@ -260,7 +262,7 @@ function siteoptions_submit(Pieform $form, $values) {
'allowpublicviews', 'allowpublicprofiles', 'creategroups', 'createpublicgroups', 'searchplugin',
'registration_sendweeklyupdates', 'institutionexpirynotification', 'institutionautosuspend',
'captchaonregisterform', 'captchaoncontactform', 'showselfsearchsideblock', 'showtagssideblock',
'tagssideblockmaxtags'
'tagssideblockmaxtags', 'country'
);
$oldlanguage = get_config('lang');
$oldtheme = get_config('theme');
......
......@@ -105,8 +105,9 @@ foreach ( $element_list as $element => $type ) {
$items[$element]['cols'] = 50;
}
if ($element == 'country') {
$items[$element]['options'] = getoptions_country();
$items[$element]['defaultvalue'] = get_config('country') ? get_config('country') : 'nz';
$countries = getoptions_country();
$items[$element]['options'] = array('' => get_string('nocountryselected')) + $countries;
$items[$element]['defaultvalue'] = get_config('country');
}
if (get_helpfile_location('artefact', 'internal', 'profileform', $element)) {
......
......@@ -803,7 +803,7 @@ function auth_check_required_fields() {
}
if ($field == 'country') {
$elements[$field]['options'] = getoptions_country();
$elements[$field]['defaultvalue'] = get_config('country') ? get_config('country') : 'nz';
$elements[$field]['defaultvalue'] = get_config('country');
}
if ($field == 'email') {
......
......@@ -859,6 +859,8 @@ $string['country.ye'] = 'Yemen';
$string['country.zm'] = 'Zambia';
$string['country.zw'] = 'Zimbabwe';
$string['nocountryselected'] = 'No Country Selected';
// general stuff that doesn't really fit anywhere else
$string['system'] = 'System';
$string['done'] = 'Done';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment