diff --git a/report/loglive/classes/renderable.php b/report/loglive/classes/renderable.php index 2c72b9b56c08..d122d073ea1e 100644 --- a/report/loglive/classes/renderable.php +++ b/report/loglive/classes/renderable.php @@ -180,7 +180,11 @@ protected function setup_filters() { $filter->logreader = $readers[$this->selectedlogreader]; $filter->date = $this->date; $filter->orderby = $this->order; - $filter->anonymous = 0; + + $context = context_course::instance($filter->courseid); + if (!has_capability('moodle/site:viewanonymousevents', $context)) { + $filter->anonymous = 0; + } return $filter; }