WordPress.org

Make WordPress Core

Changeset 3031


Ignore:
Timestamp:
11/10/2005 11:31:58 PM (14 years ago)
Author:
matt
Message:

Don't notify your own comments, fixes #1670

File:
1 edited

Legend:

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

    r2986 r3031  
    3535
    3636    $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
     37    $commentdata['user_ID']         = (int) $commentdata['user_ID'];
     38
    3739    $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
    38     $commentdata['comment_agent'] = $_SERVER['HTTP_USER_AGENT'];
    39     $commentdata['comment_date'] = current_time('mysql');
     40    $commentdata['comment_agent']     = $_SERVER['HTTP_USER_AGENT'];
     41
     42    $commentdata['comment_date']     = current_time('mysql');
    4043    $commentdata['comment_date_gmt'] = current_time('mysql', 1);
     44   
    4145
    4246    $commentdata = wp_filter_comment($commentdata);
     
    5155        if ( '0' == $commentdata['comment_approved'] )
    5256            wp_notify_moderator($comment_ID);
    53    
    54         if ( get_settings('comments_notify') && $commentdata['comment_approved'] )
     57
     58        $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
     59
     60        if ( get_settings('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
    5561            wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
    5662    }
     
    8086
    8187function wp_filter_comment($commentdata) {
    82     $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
    83     $commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
    84     $commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
    85     $commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']);
    86     $commentdata['comment_author_IP'] = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
    87     $commentdata['comment_author_url'] = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
     88    $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
     89    $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
     90    $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
     91    $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);
     92    $commentdata['comment_author_IP']    = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
     93    $commentdata['comment_author_url']   = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
    8894    $commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);
    8995    $commentdata['filtered'] = true;
Note: See TracChangeset for help on using the changeset viewer.