From a0a39b0dcb5017935f3b7185ea22e6ea2eb966f1 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Fri, 20 Jan 2012 12:51:24 +0800 Subject: [PATCH] MDL-31197 navigation: Fixed issue withing require_login for courses that are hidden or unavailable --- lib/moodlelib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 558275860ef..618d39120f7 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2744,6 +2744,10 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $ if ($preventredirect) { throw new require_login_exception('Course is hidden'); } + // We need to override the navigation URL as the course won't have + // been added to the navigation and thus the navigation will mess up + // when trying to find it. + navigation_node::override_active_url(new moodle_url('/')); notice(get_string('coursehidden'), $CFG->wwwroot .'/'); } } -- 2.11.4.GIT