From 16d45154116aa58c1f7d2d910326b05f7c81d917 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 14 Jan 2020 13:53:39 +0800 Subject: [PATCH] MDL-66213 report_loglive: Do not look up course 0 --- report/loglive/classes/renderable.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/report/loglive/classes/renderable.php b/report/loglive/classes/renderable.php index d122d073ea1e9..8c12ee9732124 100644 --- a/report/loglive/classes/renderable.php +++ b/report/loglive/classes/renderable.php @@ -174,6 +174,10 @@ protected function setup_filters() { $filter = new \stdClass(); if (!empty($this->course)) { $filter->courseid = $this->course->id; + $context = context_course::instance($filter->courseid); + if (!has_capability('moodle/site:viewanonymousevents', $context)) { + $filter->anonymous = 0; + } } else { $filter->courseid = 0; } @@ -181,11 +185,6 @@ protected function setup_filters() { $filter->date = $this->date; $filter->orderby = $this->order; - $context = context_course::instance($filter->courseid); - if (!has_capability('moodle/site:viewanonymousevents', $context)) { - $filter->anonymous = 0; - } - return $filter; }