From e467ed219f371bd730f75aff95aa1fd7f73188b4 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 10 Dec 2011 12:44:32 +0100 Subject: [PATCH] DML-30588 do not require enrollment after switching of roles --- lib/moodlelib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d6bba110a09..dbd6fcaccee 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2760,7 +2760,11 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $ $access = false; - if (is_viewing($coursecontext, $USER)) { + if (is_role_switched($course->id)) { + // ok, user had to be inside this course before the switch + $access = true; + + } else if (is_viewing($coursecontext, $USER)) { // ok, no need to mess with enrol $access = true;