WordPress.org

Make WordPress Core

Changeset 16223


Ignore:
Timestamp:
11/06/2010 03:20:50 PM (9 years ago)
Author:
ryan
Message:

Send moderation emails to post author. see #6286

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/pluggable.php

    r16208 r16223  
    10061006    $moderating_uid = (int) $user->id;
    10071007
    1008 
    10091008    if ( $comment->user_id == $post->post_author ) return false; // The comment was left by the author.
    1010        
     1009
    10111010    if ( $user->user_id == $moderating_uid ) return false; // The author moderated a comment on his own post
    10121011
     
    11001099    global $wpdb;
    11011100
    1102     if( get_option( "moderation_notify" ) == 0 )
     1101    if ( 0 == get_option( 'moderation_notify' ) )
    11031102        return true;
    11041103
    1105     $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID=%d LIMIT 1", $comment_id));
    1106     $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID=%d LIMIT 1", $comment->comment_post_ID));
     1104    $comment = get_comment($comment_id);
     1105    $post = get_post($comment->comment_post_ID);
     1106    $user = get_userdata( $post->post_author );
     1107    // Send to the administation and to the post author if the author can modify the comment.
     1108    $email_to = array( get_option('admin_email') );
     1109    if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) )
     1110        $email_to[] = $user->user_email;
    11071111
    11081112    $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
     
    11521156
    11531157    $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
    1154     $admin_email = get_option('admin_email');
    11551158    $message_headers = '';
    11561159
     
    11591162    $message_headers = apply_filters('comment_moderation_headers', $message_headers);
    11601163
    1161     @wp_mail($admin_email, $subject, $notify_message, $message_headers);
     1164    foreach ( $email_to as $email )
     1165        @wp_mail($email, $subject, $notify_message, $message_headers);
    11621166
    11631167    return true;
Note: See TracChangeset for help on using the changeset viewer.