WordPress.org

Make WordPress Core

Changeset 34537


Ignore:
Timestamp:
09/25/2015 05:36:32 AM (5 years ago)
Author:
boonebgorges
Message:

Send comment approval notification to post author via hook.

This is part of the project of #33587.

Moving this particular message to the
'wp_set_comment_status' action has the added bonus that the notification is
sent after the comment status has been updated in the database. Previously, a
database error could lead to a case where an approval notification is sent,
but the comment status change fails for some reason.

Props mrmist, NickDuncan.
Fixes #14078.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-functions.php

    r34536 r34537  
    17711771        case '1':
    17721772            $status = '1';
    1773             if ( get_option('comments_notify') ) {
    1774                 wp_notify_postauthor( $comment_id );
    1775             }
     1773            add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' );
    17761774            break;
    17771775        case 'spam':
Note: See TracChangeset for help on using the changeset viewer.