]> git.mjollnir.org Git - moodle.git/commitdiff
Delete links on forum post now only show if post has no children
authorgustav_delius <gustav_delius>
Sun, 30 May 2004 14:42:04 +0000 (14:42 +0000)
committergustav_delius <gustav_delius>
Sun, 30 May 2004 14:42:04 +0000 (14:42 +0000)
mod/forum/lib.php

index eaa19b70363a1f41416a99bcfe66dd1df6234389..26282b8ddccdb44237a0041f1cc50cfdaf97ca1c 100644 (file)
@@ -1114,7 +1114,12 @@ function forum_make_mail_post(&$post, $user, $touser, $course,
 
     $age = time() - $post->created;
     if ($ownpost) {
-        $output .= "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">".get_string("delete", "forum")."</a>";
+        if (!record_exists("forum_posts", "parent", $post->id)) {
+            $output .= "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">".get_string("delete", "forum")."</a>";
+            if ($reply) {
+                $output .= ' | ';
+            }
+        }
         if ($reply) {
             $output .= " | <a target=\"_blank\" href=\"$CFG->wwwroot/mod/forum/post.php?reply=$post->id\">".get_string("replyforum", "forum")."</a>";
         }
@@ -1246,11 +1251,13 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
         }
     }
     if ($ownpost or $isteacher) {
-        echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">$strdelete</a>";
-        if ($reply) {
-            echo "| ";
-        } else {
-            echo "&nbsp;&nbsp;";
+        if (!record_exists("forum_posts", "parent", $post->id)) {
+            echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">$strdelete</a>";
+            if ($reply) {
+                echo " | ";
+            } else {
+                echo "&nbsp;&nbsp;";
+            }
         }
     }
     if ($reply) {