Merge branch 'w02_MDL-37483_m25_redirect' of git://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 14 Jan 2013 22:29:55 +0000 (23:29 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 14 Jan 2013 22:29:55 +0000 (23:29 +0100)
lib/moodlelib.php

index d27391a..c7d6621 100644 (file)
@@ -3082,7 +3082,12 @@ function require_login($courseorid = NULL, $autologinguest = true, $cm = NULL, $
         if ($preventredirect) {
             throw new require_login_exception('Activity is hidden');
         }
-        redirect($CFG->wwwroot, get_string('activityiscurrentlyhidden'));
+        if ($course->id != SITEID) {
+            $url = new moodle_url('/course/view.php', array('id'=>$course->id));
+        } else {
+            $url = new moodle_url('/');
+        }
+        redirect($url, get_string('activityiscurrentlyhidden'));
     }
 
     // Finally access granted, update lastaccess times