diff --git a/enrol/paypal/return.php b/enrol/paypal/return.php index 81357161381..e8a5c847695 100644 --- a/enrol/paypal/return.php +++ b/enrol/paypal/return.php @@ -35,10 +35,11 @@ if (!$course = $DB->get_record("course", array("id"=>$id))) { } $context = context_course::instance($course->id, MUST_EXIST); +$PAGE->set_context($context); require_login(); -if ($SESSION->wantsurl) { +if (!empty($SESSION->wantsurl)) { $destination = $SESSION->wantsurl; unset($SESSION->wantsurl); } else {