From 14eef464944d435ae0d3086baa0da90a98be065f Mon Sep 17 00:00:00 2001
From: moodler <moodler>
Date: Mon, 31 May 2004 02:42:26 +0000
Subject: [PATCH] Undoing Gustav's checkin from yesterday ...

Sorry, Gustav, but all those record_exists calls were too much overhead.

It's better done by a check in the delete page...  this will also
account for the case where a reply has been made since the post
was displayed on screen.
---
 mod/forum/lib.php | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/mod/forum/lib.php b/mod/forum/lib.php
index affd53e6bb..a1771c23e3 100644
--- a/mod/forum/lib.php
+++ b/mod/forum/lib.php
@@ -1114,12 +1114,7 @@ function forum_make_mail_post(&$post, $user, $touser, $course,
 
     $age = time() - $post->created;
     if ($ownpost) {
-        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 .= ' | ';
-            }
-        }
+        $output .= "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">".get_string("delete", "forum")."</a>";
         if ($reply) {
             $output .= "<a target=\"_blank\" href=\"$CFG->wwwroot/mod/forum/post.php?reply=$post->id\">".get_string("replyforum", "forum")."</a>";
         }
@@ -1257,13 +1252,11 @@ function forum_print_post(&$post, $courseid, $ownpost=false, $reply=false, $link
     }
     
     if ($ownpost or $isteacher) {
-        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;";
-            }
+        echo "<a href=\"$CFG->wwwroot/mod/forum/post.php?delete=$post->id\">$strdelete</a>";
+        if ($reply) {
+            echo " | ";
+        } else {
+            echo "&nbsp;&nbsp;";
         }
     }
     if ($reply) {
-- 
2.39.5