diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index <HASH>..<HASH> 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -1246,7 +1246,7 @@ function forum_get_readable_forums($userid, $courseid=0) {
 
         $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
 
-        if (has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
+        if (!has_capability('moodle/course:viewhiddenactivities', $coursecontext)) {
             $selecthidden = ' AND cm.visible = 1';
         } else {
             $selecthidden = '';
merged fixing a broken has_capability() call