Permalink
Browse files

MDL-37483 improve require_login redirect when activity not accessible

  • Loading branch information...
1 parent bff4fc8 commit 17c88e6ec9fe3aabe1d1c8a792aa3d1f0aaac9f1 @skodak skodak committed with stronk7 Jan 13, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/moodlelib.php
View
@@ -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

0 comments on commit 17c88e6

Please sign in to comment.