]> git.mjollnir.org Git - moodle.git/commitdiff
Merged from 1.7
authorvyshane <vyshane>
Mon, 13 Nov 2006 03:27:41 +0000 (03:27 +0000)
committervyshane <vyshane>
Mon, 13 Nov 2006 03:27:41 +0000 (03:27 +0000)
mod/forum/lib.php

index 64bb482725eb923f25d33f641809a209bc3224a5..af8ced1d83025a2524dbd55df2bc4f78c2afca4f 100644 (file)
@@ -2036,6 +2036,9 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
             $commands[] = '<a href="'.$CFG->wwwroot.'/mod/forum/discuss.php?d='.
                           $post->discussion.'#'.$post->parent.'">'.$strparent.'</a>';
         }
+        $editownpost = $ownpost && has_capability('mod/forum:replypost', $modcontext);
+    } else {
+        $editownpost = $ownpost && has_capability('mod/forum:startdiscussion', $modcontext);
     }
 
     $forumtype = get_field('forum', 'type', 'id', $post->forum);
@@ -2048,7 +2051,10 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
         $age = 0;
     }
     $editanypost = has_capability('mod/forum:editanypost', $modcontext);
-    if ($ownpost or $editanypost) {
+
+    
+    
+    if ($editownpost or $editanypost) {
         if (($age < $CFG->maxeditingtime) or $editanypost) {
             $commands[] =  '<a href="'.$CFG->wwwroot.'/mod/forum/post.php?edit='.$post->id.'">'.$stredit.'</a>';
         }
@@ -2061,12 +2067,13 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
                       '" title="'.$strpruneheading.'">'.$strprune.'</a>';
     }
 
-    if (($ownpost and $age < $CFG->maxeditingtime) or
-                has_capability('mod/forum:editanypost', $modcontext)) {
+    if (($ownpost and $age < $CFG->maxeditingtime
+                and has_capability('mod/forum:deleteownpost', $modcontext))
+                or has_capability('mod/forum:deleteanypost', $modcontext)) {
         $commands[] = '<a href="'.$CFG->wwwroot.'/mod/forum/post.php?delete='.$post->id.'">'.$strdelete.'</a>';
     }
 
-    if ($reply) {
+    if ($reply and has_capability('mod/forum:replypost', $modcontext)) {
         $commands[] = '<a href="'.$CFG->wwwroot.'/mod/forum/post.php?reply='.$post->id.'">'.$strreply.'</a>';
     }