From 9c8b8eeeb50a2d59499cf1fdb55fe81a2ff45462 Mon Sep 17 00:00:00 2001
From: moodler <moodler>
Date: Thu, 1 Apr 2004 03:45:34 +0000
Subject: [PATCH] Fix for the display of hidden forums to students  - bug 1209

---
 mod/forum/index.php | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mod/forum/index.php b/mod/forum/index.php
index bcdec868ee..d585ca415b 100644
--- a/mod/forum/index.php
+++ b/mod/forum/index.php
@@ -68,7 +68,13 @@
 
         foreach ($forums as $forum) {
             if (!isset($forum->visible)) {
-                $forum->visible = true;
+                $forum->visible = instance_is_visible("forum", $forum);
+                if (!$forum->visible and !isteacher($course->id)) {
+                    if (isset($forum->keyreference)) {
+                        unset($learningforums[$forum->keyreference]);
+                    }
+                    continue;
+                }
             }
             switch ($forum->type) {
                 case "news":
-- 
2.39.5