[wp-trac] [WordPress Trac] #33717: Send Notification Email When a Comment is Approved From Moderation

WordPress Trac noreply at wordpress.org
Mon Sep 14 12:24:16 UTC 2015


#33717: Send Notification Email When a Comment is Approved From Moderation
-------------------------------------+-------------------------
 Reporter:  jeffr0                   |       Owner:  swissspidy
     Type:  feature request          |      Status:  assigned
 Priority:  normal                   |   Milestone:  4.4
Component:  Comments                 |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:
-------------------------------------+-------------------------
Changes (by jdgrimes):

 * keywords:  has-patch => has-patch needs-refresh


Comment:

 Replying to [comment:25 swissspidy]:
 > As suggested initially by @mrahmadawais, [attachment:33717.6.diff
 33717.6.diff] uses the `comment_unapproved_to_approved` hook to only send
 a notification when the comment status changes from unapproved to
 approved.

 This will still cause an email to be sent multiple times if the comment is
 approved and then unapproved and then approved again. As a result, the
 email will also be sent for old comments if the comment status is toggled
 in this way.

 I would have suggested setting a meta flag on the comment once the email
 was sent, and then checking for that to prevent multiple emails. However,
 I think maybe we need to find a more robust way to determine whether an
 approval is the initial approval, or else the emails would still be fired
 off for old comments that were received before this code existed, if the
 comment status was toggled (possibly that is just an edge case, though).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33717#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list