WordPress.org

Make WordPress Core

Ticket #761: comment.php.r19734.diff

File comment.php.r19734.diff, 3.3 KB (added by jeffstieler, 6 years ago)
  • wp-includes/comment.php

     
    569569        return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value);
    570570}
    571571
    572 /** 
    573  * Sets the cookies used to store an unauthenticated commentator's identity. Typically used 
    574  * to recall previous comments by this commentator that are still held in moderation. 
    575  * 
     572/**
     573 * Sets the cookies used to store an unauthenticated commentator's identity. Typically used
     574 * to recall previous comments by this commentator that are still held in moderation.
     575 *
    576576 * @param object $comment Comment object.
    577577 * @param object $user Comment author's object.
    578578 *
    579579 * @since 3.4.0
    580  */ 
    581 function wp_set_comment_cookies($comment, $user) { 
     580 */
     581function wp_set_comment_cookies($comment, $user) {
    582582        if ( $user->ID )
    583583                return;
    584584
     
    586586        setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    587587        setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    588588        setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN);
    589 } 
     589}
    590590
    591591/**
    592592 * Sanitizes the cookies sent to the user already.
     
    13311331 *
    13321332 * @since 1.5.0
    13331333 * @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing
     1334 * @uses apply_filters() Calls 'notify_postauthor' hook on get_option('comments_notify') before processing
    13341335 * @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved.
    13351336 * @uses wp_filter_comment() Used to filter comment before adding comment.
    13361337 * @uses wp_allow_comment() checks to see if comment is approved.
     
    13721373
    13731374                $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
    13741375
    1375                 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
     1376                $do_notify = apply_filters( 'notify_postauthor', get_option('comments_notify'), $comment_ID );
     1377
     1378                if ( $do_notify && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
    13761379                        wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
    13771380        }
    13781381
     
    13901393 *
    13911394 * @since 1.0.0
    13921395 * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
     1396 * @uses apply_filters() Calls 'notify_postauthor' hook on get_option('comments_notify') before processing
    13931397 *
    13941398 * @param int $comment_id Comment ID.
    13951399 * @param string $comment_status New comment status, either 'hold', 'approve', 'spam', or 'delete'.
     
    14081412                case 'approve':
    14091413                case '1':
    14101414                        $status = '1';
    1411                         if ( get_option('comments_notify') ) {
     1415                        $do_notify = apply_filters( 'notify_postauthor', get_option('comments_notify'), $comment_id );
     1416                        if ( $do_notify ) {
    14121417                                $comment = get_comment($comment_id);
    14131418                                wp_notify_postauthor($comment_id, $comment->comment_type);
    14141419                        }