#20353 closed enhancement (fixed)
Add filter for email recipients in wp_notify_moderator()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | minor | Version: | 3.3.1 |
Component: | Comments | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
As administrator, I would like more control over email notifications when comments are marked for moderation without having to overwrite the pluggable function wp_notify_moderator.
The function wp_notify_moderator sends emails to post authors (when they have sufficient roles) and the admin by hard coding the $email_to array. I'd like to see the $email_to array sent to a filter with $comment before wp_mail() is called. That would allow me to write a theme function to manipulate the $email_to array to add or delete recipients.
My workaround was to write a site specific plugin that overwrote wp_notify_moderator() to manipulate the $email_to array.
Attachments (1)
Change History (9)
#2
@
13 years ago
#8833 is a big task.
Many of the pluggable functions, including wp_notify_moderator() have filter hooks already available. This would be a simple line of code which I'd be happy to prepare a patch for that would apply a filter.
I could have made this work by hooking into wp_mail() but phpmailer makes the To: address property protected which was giving me fits to manipulate it.
#3
@
13 years ago
I agree lexhair, this filter is easy to implement and in fact, i'm wondering why the foreach loops on a single item oO
It seems a filter is missing here!
How can i propose a patch?
#4
@
12 years ago
- Component changed from General to Comments
- Keywords has-patch needs-testing added
Patch passes $email_to
array through apply_filters()
, for the 'comment_moderation_email_to'
filter.
Related: #22922
#6
@
12 years ago
Thanks, Nacin! The related ticket #22922 is equally low-hanging fruit, and the two combined scratch a particular itch of mine.
Related: #8833