Skip to content

Commit

Permalink
MDL-72106 calendar: redirect to same page post-subscription process.
Browse files Browse the repository at this point in the history
Avoid issues when reloading page/re-sending POST data.
  • Loading branch information
paulholden committed Aug 10, 2021
1 parent 605ce27 commit f20a20b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions calendar/managesubscriptions.php
Expand Up @@ -82,8 +82,6 @@
'course' => $course->id
));

$importresults = '';

$formdata = $form->get_data();
if (!empty($formdata)) {
require_sesskey(); // Must have sesskey for all actions.
Expand Down Expand Up @@ -112,6 +110,7 @@
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);
Expand Down Expand Up @@ -205,7 +204,7 @@
}

// 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();

0 comments on commit f20a20b

Please sign in to comment.