[wp-trac] [WordPress Trac] #761: Add hook to conditionally disable comment notifications [w/ patch]

WordPress Trac wp-trac at lists.automattic.com
Sun Sep 16 16:40:48 UTC 2012


#761: Add hook to conditionally disable comment notifications [w/ patch]
-------------------------------------+-----------------------
 Reporter:  coffee2code              |       Owner:  matt
     Type:  enhancement              |      Status:  reopened
 Priority:  normal                   |   Milestone:  3.5
Component:  Comments                 |     Version:  1.2.2
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+-----------------------

Comment (by nacin):

 This filter is clever but I wonder if all of that context should be passed
 to the filter, rather than happening after $do_notify. So:

 {{{
 $maybe_notify = get_option( 'comments_notify' ) &&
 $commentdata['comment_approved'];
 if ( isset( $commentdata['user_id'] ) && $post->post_author ==
 $commentdata['user_id'] )
     $maybe_notify = false;
 $maybe_notify = apply_filters( 'notify_post_author', $maybe_notify,
 $comment_ID );
 }}}

 I could go either way on this, though. It can be argued that only sending
 emails for approved comments and never sending emails to the comment
 author don't need to be filtered. It would however be weird for that
 filter to run for a comment ID that these checks later prevent. So perhaps
 the comment_approved and user_id checks take place, then the filter, then
 the function call.

 It should also be noted that wp_notify_postauthor() also checks
 `$comment->user_id == $post->post_author` already (and has for some time),
 so maybe we should just be always calling wp_notify_postauthor() and let
 the function later in the stack handle it.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/761#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list