diff --git a/admin/registration/forms.php b/admin/registration/forms.php index c4373d107d6..af26d35aff6 100644 --- a/admin/registration/forms.php +++ b/admin/registration/forms.php @@ -225,19 +225,25 @@ class site_registration_form extends moodleform { $imageurl = get_config('hub', 'site_imageurl_' . $cleanhuburl); $privacy = get_config('hub', 'site_privacy_' . $cleanhuburl); $address = get_config('hub', 'site_address_' . $cleanhuburl); + if ($address === false) { + $address = ''; + } $region = get_config('hub', 'site_region_' . $cleanhuburl); $country = get_config('hub', 'site_country_' . $cleanhuburl); - if ($country === false) { - $country = $admin->country; + if (empty($country)) { + $country = $admin->country ?: $CFG->country; } $language = get_config('hub', 'site_language_' . $cleanhuburl); if ($language === false) { $language = explode('_', current_language())[0]; } $geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl); + if ($geolocation === false) { + $geolocation = ''; + } $contactable = get_config('hub', 'site_contactable_' . $cleanhuburl); $emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl); - $emailalert = ($emailalert === 0) ? 0 : 1; + $emailalert = ($emailalert === false || $emailalert) ? 1 : 0; $coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl); $usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl); $roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl); @@ -306,11 +312,12 @@ class site_registration_form extends moodleform { $mform->addElement('hidden', 'regioncode', '-'); $mform->setType('regioncode', PARAM_ALPHANUMEXT); - $countries = get_string_manager()->get_list_of_countries(); + $countries = ['' => ''] + get_string_manager()->get_list_of_countries(); $mform->addElement('select', 'countrycode', get_string('sitecountry', 'hub'), $countries); $mform->setDefault('countrycode', $country); $mform->setType('countrycode', PARAM_ALPHANUMEXT); $mform->addHelpButton('countrycode', 'sitecountry', 'hub'); + $mform->addRule('countrycode', $strrequired, 'required', null, 'client'); $mform->addElement('text', 'geolocation', get_string('sitegeolocation', 'hub'), array('class' => 'registration_textfield')); @@ -328,6 +335,7 @@ class site_registration_form extends moodleform { $mform->addElement('text', 'contactphone', get_string('sitephone', 'hub'), array('class' => 'registration_textfield')); $mform->setType('contactphone', PARAM_TEXT); + $mform->setDefault('contactphone', $contactphone); $mform->addHelpButton('contactphone', 'sitephone', 'hub'); $mform->setForceLtr('contactphone');