Merge branch 'MDL-49583-m28' of https://github.com/NeillM/moodle into MOODLE_28_STABLE

This commit is contained in:
Andrew Nicols
2015-04-30 15:11:42 +08:00
+6
View File
@@ -28,6 +28,12 @@ require_once("$CFG->libdir/formslib.php");
$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());