Add filters to the recipients of emails sent by wp_notify_postauthor() and wp_notify_moderator().
The new filters are called comment_notification_recipients and comment_moderation_recipients. Add the context of $comment_id to the comment_moderation_headers filter, to match the comment_notification_headers filter. props chipbennett. fixes #22922, #20353. git-svn-id: https://develop.svn.wordpress.org/trunk@25104 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9211de7232
commit
1f24e6d76b
|
@ -1074,11 +1074,16 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) {
|
|||
if ( isset($reply_to) )
|
||||
$message_headers .= $reply_to . "\n";
|
||||
|
||||
$emails = array( $author->user_email );
|
||||
|
||||
$emails = apply_filters( 'comment_notification_recipients', $emails, $comment_id );
|
||||
$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment_id );
|
||||
$subject = apply_filters( 'comment_notification_subject', $subject, $comment_id );
|
||||
$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment_id );
|
||||
|
||||
@wp_mail( $author->user_email, $subject, $notify_message, $message_headers );
|
||||
foreach ( $emails as $email ) {
|
||||
@wp_mail( $emails, $subject, $notify_message, $message_headers );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1104,9 +1109,9 @@ function wp_notify_moderator($comment_id) {
|
|||
$post = get_post($comment->comment_post_ID);
|
||||
$user = get_userdata( $post->post_author );
|
||||
// Send to the administration and to the post author if the author can modify the comment.
|
||||
$email_to = array( get_option('admin_email') );
|
||||
$emails = array( get_option('admin_email') );
|
||||
if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) )
|
||||
$email_to[] = $user->user_email;
|
||||
$emails[] = $user->user_email;
|
||||
|
||||
$comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
|
||||
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
|
||||
|
@ -1156,12 +1161,14 @@ function wp_notify_moderator($comment_id) {
|
|||
$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
|
||||
$message_headers = '';
|
||||
|
||||
$emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
|
||||
$notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
|
||||
$subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
|
||||
$message_headers = apply_filters('comment_moderation_headers', $message_headers);
|
||||
$message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
|
||||
|
||||
foreach ( $email_to as $email )
|
||||
foreach ( $emails as $email ) {
|
||||
@wp_mail( $email, $subject, $notify_message, $message_headers );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue