Here is the code I have that has 2 instances of it in the editpost.php.
Code:
if ($action=="deletepost") {
// +++++++ Start Checking Delete Post Permissions [ Start ] +++++++
$perms=getpermissions();
if(!$perms[candeleteposts]) {
eval("standarderror(\"".gettemplate("error_cantdeleteposts")."\");");
exit;
}
// +++++++ Start Checking Delete Post Permissions [ End ] +++++++
if ($deletepost=="yes") {
//get first post in thread
$getfirst=$DB_site->query_first("SELECT postid,dateline FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
if ($getfirst[postid]==$postid) {
// delete thread
if ($getperms[candeletethread]) {
deletethread($threadinfo[threadid],$foruminfo[countposts]);
updateforumcount($threadinfo[forumid]);
eval("standardredirect(\"".gettemplate("redirect_deletethread")."\",\"forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]\");");
} else {
show_nopermission();
}
} else {
//delete just this post
$foruminfo=getforuminfo($threadinfo[forumid]);
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
updatethreadcount($threadinfo[threadid]);
updateforumcount($threadinfo[forumid]);
eval("standardredirect(\"".gettemplate("redirect_deletepost")."\",\"showthread.php?s=$session[sessionhash]&threadid=$threadinfo[threadid]\");");
}
} else {
eval("standardredirect(\"".gettemplate("redirect_nodelete")."\",\"showthread.php?s=$session[sessionhash]&postid=$postid#post$postid\");");
}
}
if ($action=="deletethispost") {
$firstpost=$DB_site->query_first("SELECT postid,dateline FROM post WHERE threadid='$threadid' ORDER BY dateline LIMIT 1");
if ($postid==$firstpost[postid]) {
if ($getperms[candeletethread]) {
deletethread($threadinfo[threadid],$foruminfo[countposts]);
updateforumcount($threadinfo[forumid]);
$url="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
eval("standardredirect(\"".gettemplate("redirect_deletethread")."\",\"$url\");");
} else {
show_nopermission();
}
} else {
$foruminfo=getforuminfo($threadinfo[forumid]);
deletepost($postid,$foruminfo[countposts],$threadinfo[threadid]);
updatethreadcount($threadinfo[threadid]);
updateforumcount($threadinfo[forumid]);
$url="showthread.php?s=$session[sessionhash]&threadid=$threadinfo[threadid]";
eval("standardredirect(\"".gettemplate("redirect_deletepost")."\",\"$url\");");
}
}
?>
What should I use for the newreply then? If it does have attachments in it, will it work?