From 5e71406d934589f78613eef1ed65c16d70599ce3 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Fri, 31 Oct 2008 19:05:56 +0000 Subject: [PATCH] MDL-14998 - roles: User needs to have mod/forum:viewdiscussion to be able to see news block. Merged from 19_STABLE --- blocks/news_items/block_news_items.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/blocks/news_items/block_news_items.php b/blocks/news_items/block_news_items.php index 58b086c484..7512097771 100644 --- a/blocks/news_items/block_news_items.php +++ b/blocks/news_items/block_news_items.php @@ -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 .= '