From f76b19dde72e707e08fa7f4e46545cbf86b29a11 Mon Sep 17 00:00:00 2001 From: mikelittle Date: Wed, 5 Nov 2003 00:11:03 +0000 Subject: [PATCH] Added delete link to comment notification mail. Contribution from Craig R Hughes craig at hughes-family dot org git-svn-id: http://svn.automattic.com/wordpress/trunk@524 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- b2comments.post.php | 2 ++ wp-admin/wp-post.php | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/b2comments.post.php b/b2comments.post.php index b37bb6cc1..397caf09c 100644 --- a/b2comments.post.php +++ b/b2comments.post.php @@ -84,6 +84,7 @@ if (!empty($lasttime)) { if ($ok) { // if there was no comment from this IP in the last 10 seconds $wpdb->query("INSERT INTO $tablecomments VALUES ('0', '$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$comment', '0')"); + $comment_ID = $wpdb->get_var("SELECT last_insert_id()"); if ($comments_notify) { $postdata = get_postdata($comment_post_ID); @@ -95,6 +96,7 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds $notify_message .= "E-mail : $comment_author_email\r\n"; $notify_message .= "URL : $comment_author_url\r\n"; $notify_message .= "Whois : http://ws.arin.net/cgi-bin/whois.pl?queryinput=$user_ip\r\n"; + $notify_message .= "Delete : $siteurl/wp-admin/wp-post.php?action=deletecomment&p=$comment_post_ID&comment=$comment_ID \r\n"; $notify_message .= "Comment:\r\n".stripslashes($original_comment)."\r\n\r\n"; $notify_message .= "You can see all comments on this post here: \r\n"; $notify_message .= $siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal.$comment_post_ID.$querystring_separator.'c'.$querystring_equal.'1#comments'; diff --git a/wp-admin/wp-post.php b/wp-admin/wp-post.php index 171d4a65f..49d6207b5 100644 --- a/wp-admin/wp-post.php +++ b/wp-admin/wp-post.php @@ -356,7 +356,11 @@ switch($action) { $result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_ID=$comment"); - header ('Location: ' . $HTTP_SERVER_VARS['HTTP_REFERER']); + if($HTTP_SERVER_VARS['HTTP_REFERER'] != "") { + header('Location: ' . $HTTP_SERVER_VARS['HTTP_REFERER']); + } else { + header('Location: '.$siteurl.'/wp-admin/'); + } break;