From 21b89cb43b2726c82b550d8f43528ad98fa3ed9f Mon Sep 17 00:00:00 2001
From: toyomoyo <toyomoyo>
Date: Tue, 13 Mar 2007 04:49:05 +0000
Subject: [PATCH] allow guests to see the reply link

---
 mod/forum/discuss.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php
index 425e691fa1..171d4098e1 100644
--- a/mod/forum/discuss.php
+++ b/mod/forum/discuss.php
@@ -168,8 +168,7 @@
     }
     
     $groupmode = groupmode($course, $cm);  
-    if ($canreply = has_capability($capname, $modcontext)) { 
-    
+    if ($canreply = has_capability($capname, $modcontext)) {
          
         if ($groupmode && !has_capability('moodle/site:accessallgroups', $modcontext)) {   
             // Groups must be kept separate
@@ -193,6 +192,11 @@
                     (ismember($discussion->groupid) || $mygroupid == $discussion->groupid) );
             }
         }
+    } else { // allow guests to see the link
+        $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
+        if (has_capability('moodle/legacy:guest', $coursecontext, NULL, false)) {  // User is a guest here!
+            $canreply = true;
+        }
     }
 
 /// Print the controls across the top
-- 
2.39.5