hack for email notification to threaded comment au
-
so i love the threaded comments hack by LaughingLizard and hope it gets into the main package soon. but i don’t like that it doesn’t notify authors of comments when there is a reply to their post.
here’s a hack that provides that functionality, to be applied after you apply the threaded comments hack.
in wp-includes/functions.php:
change line
function wp_notify_postauthor($comment_id, $comment_type='comment') {
to be
function wp_notify_postauthor($comment_id, $comment_type='comment', $comment_reply_ID='') {
change line
if ('' == $user->user_email) return false; // If there's no email to send the comment to
to be
if ('' == $user->user_email && 'reply' != $comment_type) return false; // If there's no email to send the comment to or if it's a reply
insert after
if ('comment' == $comment_type) {
the following lines
$comment_reply = $wpdb->get_row("SELECT comment_reply_ID FROM $tablecomments WHERE comment_ID = '$comment_id'");
$comment_reply_ID = $comment_reply->comment_reply_ID;
if($comment_reply_ID != '') wp_notify_postauthor($comment_id, 'reply', $comment_reply_ID);
insert after
$subject = '[' . $blogname . '] Pingback: "' .stripslashes($post->post_title).'"';
}
the following lines
elseif ('reply' == $comment_type) {
$mail_row = $wpdb->get_row("SELECT comment_author_email FROM $tablecomments WHERE comment_ID = $comment_reply_ID");
$mail_addr = $mail_row->comment_author_email;
if('' == $mail_addr) return false;
$notify_message = "New reply to your comment #$comment->comment_reply_ID in post \"".stripslashes($post->post_title)."\"\r\n\r\n";
$notify_message .= "Author : $comment->comment_author\r\n";
$notify_message .= "Website: $comment->comment_author_url\r\n";
$notify_message .= "Comment:\r\n".stripslashes($comment->comment_content)."\r\n\r\n";
$notify_message .= "You can see all comments on this post here: \r\n";
$subject = '[' . $blogname . '] Comment: "' .stripslashes($post->post_title).'"';
}
let me know if it works/doesn’t work for you.
- The topic ‘hack for email notification to threaded comment au’ is closed to new replies.