Make WordPress Core

Ticket #17862: 17862.2.diff

File 17862.2.diff, 2.6 KB (added by scribu, 14 years ago)

Clarification in wp_new_comment()

  • wp-includes/comment.php

     
    13521352                if ( '0' == $commentdata['comment_approved'] )
    13531353                        wp_notify_moderator($comment_ID);
    13541354
    1355                 $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
     1355                if ( get_option('comments_notify') && $commentdata['comment_approved'] ) {
     1356                        $post = get_post( $commentdata['comment_post_ID'] );
    13561357
    1357                 if ( get_option('comments_notify') && $commentdata['comment_approved'] && ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] ) )
    1358                         wp_notify_postauthor($comment_ID, isset( $commentdata['comment_type'] ) ? $commentdata['comment_type'] : '' );
     1358                        // Don't notify if it's your own comment
     1359                        if ( ! isset( $commentdata['user_id'] ) || $post->post_author != $commentdata['user_id'] )
     1360                                wp_notify_postauthor( $comment_ID );
     1361                }
    13591362        }
    13601363
    13611364        return $comment_ID;
     
    13911394                case '1':
    13921395                        $status = '1';
    13931396                        if ( get_option('comments_notify') ) {
    1394                                 $comment = get_comment($comment_id);
    1395                                 wp_notify_postauthor($comment_id, $comment->comment_type);
     1397                                wp_notify_postauthor( $comment_id );
    13961398                        }
    13971399                        break;
    13981400                case 'spam':
  • wp-includes/pluggable.php

     
    10401040 * @since 1.0.0
    10411041 *
    10421042 * @param int $comment_id Comment ID
    1043  * @param string $comment_type Optional. The comment type either 'comment' (default), 'trackback', or 'pingback'
     1043 * @param string $deprecated Not used
    10441044 * @return bool False if user email does not exist. True on completion.
    10451045 */
    1046 function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
     1046function wp_notify_postauthor( $comment_id, $deprecated = null ) {
     1047        if ( null !== $deprecated )
     1048                _deprecated_argument( __FUNCTION__, '3.3' );
     1049
    10471050        $comment = get_comment( $comment_id );
    10481051        $post    = get_post( $comment->comment_post_ID );
    10491052        $author  = get_userdata( $post->post_author );
     
    10661069        // we want to reverse this for the plain text arena of emails.
    10671070        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    10681071
    1069         if ( empty( $comment_type ) ) $comment_type = 'comment';
     1072        $comment_type = $comment->comment_type ? $comment->comment_type : 'comment';
    10701073
    10711074        if ('comment' == $comment_type) {
    10721075                $notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";