MDL-28615 forum: Fixed missing context regression
authorSam Hemelryk <sam@moodle.com>
Tue, 4 Oct 2011 03:34:54 +0000 (16:34 +1300)
committerSam Hemelryk <sam@moodle.com>
Tue, 4 Oct 2011 03:37:16 +0000 (16:37 +1300)
mod/forum/lib.php

index e3547a4..e924850 100644 (file)
@@ -5071,7 +5071,7 @@ function forum_user_can_see_post($forum, $discussion, $post, $user=NULL, $cm=NUL
         $user = $USER;
     }
 
-    $canviewdiscussion = !empty($cm->cache->caps['mod/forum:viewdiscussion']) || has_capability('mod/forum:viewdiscussion', $modcontext, $user->id);
+    $canviewdiscussion = !empty($cm->cache->caps['mod/forum:viewdiscussion']) || has_capability('mod/forum:viewdiscussion', get_context_instance(CONTEXT_MODULE, $cm->id), $user->id);
     if (!$canviewdiscussion && !has_all_capabilities(array('moodle/user:viewdetails', 'moodle/user:readuserposts'), get_context_instance(CONTEXT_USER, $post->userid))) {
         return false;
     }