Notification Emails Not Send After Comment Approval in WordPress 2.5 and 2.5.1

In WordPress 2.5 and Wordpress 2.5.1, when the option is set to email post author whenever a comment is posted (comments_notify = 1), no notification email is generated or sent to notify the post author if the comment is held in moderation queue and is only approved later via edit-comments.php.

Prior to WordPress 2.5, an email is sent on approval to post author even if a comment is required to be approved and not posted instantly. However, notification that a comment is held for moderation and require administrator’s action to approve, delete or spam the message is working properly, with email sends to administrator’s email address (admin_email), not post author.

It’s a bug that has been introduced in WordPress 2.5, and slips into WordPress 2.5.1 when moderation.php functionality was moved into edit-comments.php. The bug will probably be fixed in WordPress 2.5.2 release. If you can’t wait, simply edit wp-includes/comment.php on WordPress blog directory on web server, and add the following lines of code:

Before:

break;
case 'approve':
$query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID = %d LIMIT 1", $comment_id);
break;
case 'spam':
$query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID = %d LIMIT 1", $comment_id);

After:

break;
case 'approve':
$query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID = %d LIMIT 1", $comment_id);
if ( get_option( 'comments_notify' ) == true ) {
wp_notify_postauthor( $comment );
}
break;
case 'spam':
$query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID = %d LIMIT 1", $comment_id);



7 Responses to “Notification Emails Not Send After Comment Approval in WordPress 2.5 and 2.5.1”

  1. Guillermo Scharffenorth
    June 20th, 2008 11:29
    1

    Hello,

    The code you printed under ‘before’ is different in that the one in wp-includes/comment.php. This is the code in comment.php:

    case 'approve':
    $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
    break;
    case 'spam':
    $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";

    Which version of WP did you get that code from?

  2. admin
    June 20th, 2008 11:53
    2

    version 2.5.

  3. Guillermo Scharffenorth
    June 20th, 2008 11:57
    3

    Hi,

    The code I posted is from 2.5.1. Do you think that replacing this code with the one you posted could fix this issue?

  4. admin
    June 20th, 2008 12:28
    4

    Try to just add in the additional lines (the difference).

  5. Guillermo Scharffenorth
    June 27th, 2008 20:49
    5

    Hello,

    Tried it. It did not work. Thanks anyways.

  6. paul
    July 11th, 2008 17:30
    6

    Thanks for the post ‘admin’ - I help manage a (non?)corporate blog, and my boss stopped getting email notifications since upgrading to 2.5.x - I do believe your suggested patch has fixed it.

    So, again thanks very much!

  7. Chris
    September 4th, 2008 04:15
    7

    This WPMU behavior was driving me a bit nuts. Much thanks for sharing your solution!

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting


Custom Search

Incoming Search Terms for the Article

wordpress not sending email - wordpress - wordpress 2.5 email moderation - comment notification wordpress - wordpress not sending notification - no comment notifications wordpress 2.5 - wordpress author comment notification - how do i set comment approval? - wordpress email comment author - Wordpress comment notification email - wordpress 2.5.1 not sending mail - wordpress 2.5.1 not receiving new comment emails - wordpress comment approval email - wordpress comment notification - wordpress is not sending e-mail notification with gmail - wordpress not emailing notifications - wordpress 2.5 email authors when comments posted - Notification Emails Not Send After Comment Approval - wordpress email comments for approval - wordpress Register Plus not sending email - wordpress 2.5 not sending email - wordpress 2.5.1 email notification - new comment notification wordpress 2.5 admin - wordpress 2.5.1 not receiving emails - approve comments php - $wpdb->query not working 2.5 - comment notification wordpress 2.5 - 2.5.1, comment notification, wordpress - wordpress notification 2.5 disable - send comments in wordpress to email - wordpress approval email - wordpress comment notification on approval - wordpress, comment notification, problem, 2.5 - wordpress 2.5 no notification email - moderation notification wordpress - wordpress auto comment elfogadás - wordpress not sending comment notification emails - wordpress register-plus - wp_notify_postauthor override - wordpress no email notification comment - wont translate edit-comments.php approved - send to admin not author comment notification wordpress - wordpress 2.5.2 problem + mail notification - wordpress notification not working 2.5 comment - wordpress 2.5+ new comment + notify admin - wordpress comment no approval email - wordpress. comment notification, php, 2.5 - wordpress comment approving not sending email - wordpress not sending email comments 2.51 - WordPress : not receiving email notification when comments are approved -