From: defacer Date: Mon, 17 May 2004 09:07:05 +0000 (+0000) Subject: Fix for bug 1323: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b1bcd540f03c4b7f5cfe62d06ad389cc47a959b5;p=moodle.git Fix for bug 1323: When the admin is logged in as a different user, user events are shown correctly in the calendar. Also, fixed a very-recently-introduced bug which appears to have escaped notice so far. --- diff --git a/calendar/event.php b/calendar/event.php index 62f2226da0..d7f9ffed33 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -492,7 +492,7 @@ function calendar_get_allowed_types(&$allowed) { $allowed->courses = false; // This may change just below $allowed->site = isadmin($USER->id); - if(!empty($SESSION->cal_course_referer)) { + if(!empty($SESSION->cal_course_referer) && isteacheredit($SESSION->cal_course_referer, $USER->id)) { $allowed->courses = array($SESSION->cal_course_referer => 1); $allowed->groups = get_groups($SESSION->cal_course_referer); } diff --git a/calendar/lib.php b/calendar/lib.php index 3ddaf75ec7..5f23878574 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1055,7 +1055,12 @@ function calendar_set_filters(&$courses, &$group, &$user, $defaultcourses = NULL } if($SESSION->cal_show_user) { - $user = $SESSION->cal_show_user; + // This ignores the "which user to see" setting + // The functionality to do that does exist, but this was + // the most painless way to solve bug 1323. And anyway, + // it wasn't being used anywhere. + $user = $USER->id; + //$user = $SESSION->cal_show_user; } else { $user = false;