Skip to content

Commit

Permalink
Merge branch 'MDL-49583-m28' of https://github.com/NeillM/moodle into…
Browse files Browse the repository at this point in the history
… MOODLE_28_STABLE
  • Loading branch information
andrewnicols committed Apr 30, 2015
2 parents e3a371a + eaba80f commit 9495b31
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions enrol/index.php
Expand Up @@ -28,6 +28,12 @@
$id = required_param('id', PARAM_INT);

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());
Expand Down

0 comments on commit 9495b31

Please sign in to comment.