]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14998 - roles: User needs to have mod/forum:viewdiscussion to be able to see...
authorstronk7 <stronk7>
Fri, 31 Oct 2008 19:05:56 +0000 (19:05 +0000)
committerstronk7 <stronk7>
Fri, 31 Oct 2008 19:05:56 +0000 (19:05 +0000)
blocks/news_items/block_news_items.php

index 58b086c4845202953a554affa34e83d9f38b776f..751209777161c8401b2252ea3abe2eca27cb42c5 100644 (file)
@@ -40,10 +40,15 @@ class block_news_items extends block_base {
 
             $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
+        /// User must have perms to view discussions in that forum
+            if (!has_capability('mod/forum:viewdiscussion', $context)) {
+                return '';
+            }
+
         /// First work out whether we can post to this group and if so, include a link
             $groupmode    = groups_get_activity_groupmode($cm);
             $currentgroup = groups_get_activity_group($cm, true);
-            
+
 
             if (forum_user_can_post_discussion($forum, $currentgroup, $groupmode, $cm, $context)) {
                 $text .= '<div class="newlink"><a href="'.$CFG->wwwroot.'/mod/forum/post.php?forum='.$forum->id.'">'.