From 5b30467894d891264572acbe620aec762ebedd11 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 12 Jul 2021 21:12:05 +0100 Subject: [PATCH] MDL-72106 calendar: redirect to same page post-subscription process. Avoid issues when reloading page/re-sending POST data. --- calendar/managesubscriptions.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/calendar/managesubscriptions.php b/calendar/managesubscriptions.php index 91fbf6595cd..93f4b96b927 100644 --- a/calendar/managesubscriptions.php +++ b/calendar/managesubscriptions.php @@ -82,8 +82,6 @@ $form->set_data(array( 'course' => $course->id )); -$importresults = ''; - $formdata = $form->get_data(); if (!empty($formdata)) { require_sesskey(); // Must have sesskey for all actions. @@ -112,6 +110,7 @@ if (!empty($formdata)) { if (calendar_can_edit_subscription($subscriptionid)) { try { $importresults = calendar_process_subscription_row($subscriptionid, $pollinterval, $action); + redirect($PAGE->url, $importresults); } catch (moodle_exception $e) { // If exception caught, then user should be redirected to page where he/she came from. print_error($e->errorcode, $e->module, $PAGE->url); @@ -205,7 +204,7 @@ foreach($subscriptions as $subscription) { } // Display a table of subscriptions. -echo $renderer->subscription_details($courseid, $subscriptions, $importresults); +echo $renderer->subscription_details($courseid, $subscriptions); // Display the add subscription form. $form->display(); echo $OUTPUT->footer();