Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-37822 move the default code above the set_config to not make the …

…code less confusing
  • Loading branch information...
commit 1fc34e37fdc57b4ec303cb942dc5d5535b953ed7 1 parent 667eaec
@mouneyrac mouneyrac authored stronk7 committed
Showing with 12 additions and 11 deletions.
  1. +12 −11 admin/registration/register.php
View
23 admin/registration/register.php
@@ -62,7 +62,18 @@
$fromform = $siteregistrationform->get_data();
if (!empty($fromform) and confirm_sesskey()) {
- //save the settings
+
+ // Set to -1 all optional data marked as "don't send" by the admin.
+ // The function get_site_info() will not calculate the optional data if config is set to -1.
+ $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
+ 'modulenumberaverage', 'participantnumberaverage');
+ foreach ($inputnames as $inputname) {
+ if (empty($fromform->{$inputname})) {
+ $fromform->{$inputname} = -1;
+ }
+ }
+
+ // Save the settings.
$cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
@@ -78,16 +89,6 @@
set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
-
- // Set to -1 all optional data marked as "don't send" by the admin.
- // The function get_site_info() will not calculate the optional data if config is set to -1.
- $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
- 'modulenumberaverage', 'participantnumberaverage');
- foreach ($inputnames as $inputname) {
- if (empty($fromform->{$inputname})) {
- $fromform->{$inputname} = -1;
- }
- }
set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
Please sign in to comment.
Something went wrong with that request. Please try again.