Commit 824c1dbb authored by Robert Lyon's avatar Robert Lyon

Bug 1486813: Stop redirect to 'register site' page after each upgrade

By adding a cancel option to the register site form that clears the
new_registration_policy config setting.

behatnotneeded

Change-Id: I65cf7239b9fe021d17be387eeb8bfda9547c5032
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent bd084edc
...@@ -26,7 +26,7 @@ if (param_integer('finished', 0)) { ...@@ -26,7 +26,7 @@ if (param_integer('finished', 0)) {
$message .= ' ' . get_string('ensurepluginsexist', 'admin', get_config('docroot')); $message .= ' ' . get_string('ensurepluginsexist', 'admin', get_config('docroot'));
$SESSION->add_error_msg($message); $SESSION->add_error_msg($message);
} }
if (get_config('new_registration_policy')) { if (get_config('new_registration_policy') == 1) {
redirect('/admin/registersite.php'); redirect('/admin/registersite.php');
} }
redirect(); redirect();
......
...@@ -216,6 +216,7 @@ $string['datathathavebeensent'] = 'Data that have been sent'; ...@@ -216,6 +216,7 @@ $string['datathathavebeensent'] = 'Data that have been sent';
$string['sendweeklyupdates'] = 'Send weekly updates?'; $string['sendweeklyupdates'] = 'Send weekly updates?';
$string['sendweeklyupdatesdescription'] = 'If checked, your site will send weekly updates to mahara.org with some statistics about your site'; $string['sendweeklyupdatesdescription'] = 'If checked, your site will send weekly updates to mahara.org with some statistics about your site';
$string['Register'] = 'Register'; $string['Register'] = 'Register';
$string['registrationcancelled'] = 'You can choose to register at any time by going to the <a href="%sadmin/registersite.php">site registration page</a>.';
$string['registrationfailedtrylater'] = 'Registration failed with error code %s. Please try again later.'; $string['registrationfailedtrylater'] = 'Registration failed with error code %s. Please try again later.';
$string['registrationsuccessfulthanksforregistering'] = 'Registration successful - thanks for registering.'; $string['registrationsuccessfulthanksforregistering'] = 'Registration successful - thanks for registering.';
$string['registeryourmaharasite'] = 'Register your Mahara site'; $string['registeryourmaharasite'] = 'Register your Mahara site';
......
...@@ -3232,7 +3232,10 @@ function xmldb_core_upgrade($oldversion=0) { ...@@ -3232,7 +3232,10 @@ function xmldb_core_upgrade($oldversion=0) {
if ($oldversion < 2014032726) { if ($oldversion < 2014032726) {
// As we changed the registration site policy, // As we changed the registration site policy,
// We need to remind the site admins to register the site again with the new policy. // We need to remind the site admins to register the site again with the new policy.
set_config('new_registration_policy', true); log_debug('Remind the site admins to register the site again with the new policy');
if (get_config('new_registration_policy') != -1) {
set_config('new_registration_policy', true);
}
if (get_config('registration_sendweeklyupdates')) { if (get_config('registration_sendweeklyupdates')) {
set_config('registration_sendweeklyupdates', false); set_config('registration_sendweeklyupdates', false);
} }
......
...@@ -59,8 +59,8 @@ EOF; ...@@ -59,8 +59,8 @@ EOF;
'defaultvalue' => true, 'defaultvalue' => true,
), ),
'register' => array( 'register' => array(
'type' => 'submit', 'type' => 'submitcancel',
'value' => get_string('Register', 'admin'), 'value' => array(get_string('Register', 'admin'), get_string('cancel', 'mahara')),
), ),
) )
); );
...@@ -106,9 +106,22 @@ function register_submit(Pieform $form, $values) { ...@@ -106,9 +106,22 @@ function register_submit(Pieform $form, $values) {
$SESSION->add_ok_msg($info, false); $SESSION->add_ok_msg($info, false);
} }
redirect('/admin/'); redirect('/admin/index.php');
} }
/**
* Runs when registration form is cancelled
*/
function register_cancel_register() {
global $SESSION;
if (get_config('new_registration_policy')) {
set_config('new_registration_policy', -1);
$SESSION->add_ok_msg(get_string('registrationcancelled', 'admin', get_config('wwwroot')), false);
}
redirect('/admin/index.php');
}
/** /**
* Worker - performs sending of registration data to mahara.org * Worker - performs sending of registration data to mahara.org
......
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