Make WordPress Core

Ticket #761: 761.diff

File 761.diff, 2.0 KB (added by coffee2code, 12 years ago)

Refresh of jeffstieler's patch to apply cleanly against trunk (with minor tweaks)

  • wp-includes/comment.php

     
    13261326 *
    13271327 * @since 1.5.0
    13281328 * @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing
     1329 * @uses apply_filters() Calls 'notify_postauthor' hook on get_option('comments_notify') before processing
    13291330 * @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved.
    13301331 * @uses wp_filter_comment() Used to filter comment before adding comment.
    13311332 * @uses wp_allow_comment() checks to see if comment is approved.
     
    13671368
    13681369                $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
    13691370
    1370                 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
     1371                $do_notify = apply_filters( 'notify_postauthor', get_option( 'comments_notify' ), $comment_ID );
     1372
     1373                if ( $do_notify && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
    13711374                        wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
    13721375        }
    13731376
     
    13821385 *
    13831386 * @since 1.0.0
    13841387 * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
     1388 * @uses apply_filters() Calls 'notify_postauthor' hook on get_option('comments_notify') before processing
    13851389 *
    13861390 * @param int $comment_id Comment ID.
    13871391 * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'trash'.
     
    14001404                case 'approve':
    14011405                case '1':
    14021406                        $status = '1';
    1403                         if ( get_option('comments_notify') ) {
     1407                        if ( apply_filters( 'notify_postauthor', get_option( 'comments_notify' ), $comment_id ) ) {
    14041408                                $comment = get_comment($comment_id);
    14051409                                wp_notify_postauthor($comment_id, $comment->comment_type);
    14061410                        }