mirror of
https://github.com/moodle/moodle.git
synced 2025-04-25 10:26:17 +02:00
Merge branch 'MDL-49583' of https://github.com/NeillM/moodle
This commit is contained in:
commit
e841d654aa
@ -29,6 +29,12 @@ $id = required_param('id', PARAM_INT);
|
||||
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);
|
||||
|
||||
if (!isloggedin()) {
|
||||
$referer = clean_param(get_referer(), PARAM_LOCALURL);
|
||||
if (empty($referer)) {
|
||||
// A user that is not logged in has arrived directly on this page,
|
||||
// they should be redirected to the course page they are trying to enrol on after logging in.
|
||||
$SESSION->wantsurl = "$CFG->wwwroot/course/view.php?id=$id";
|
||||
}
|
||||
// do not use require_login here because we are usually coming from it,
|
||||
// it would also mess up the SESSION->wantsurl
|
||||
redirect(get_login_url());
|
||||
|
Loading…
x
Reference in New Issue
Block a user