diff --git a/block_alerts.php b/block_alerts.php index 24093e7..95c21e4 100644 --- a/block_alerts.php +++ b/block_alerts.php @@ -84,11 +84,8 @@ public function get_content(): stdClass { public static function is_teacher(): bool { global $DB, $USER; - // System level roles. - $context = context_system::instance(); - $roles = get_user_roles($context, $USER->id); // Check for manager or coursecreator role. - foreach ($roles as $role) { + foreach (get_user_roles(context_system::instance()) as $role) { if ($role->shortname === 'manager' || $role->shortname === 'coursecreator') { return true; }