[wp-trac] [WordPress Trac] #54874: [New User Notification] Allow conditional mail supression

WordPress Trac noreply at wordpress.org
Fri Jan 21 12:06:30 UTC 2022


#54874: [New User Notification] Allow conditional mail supression
-------------------------+-----------------------------
 Reporter:  janthiel     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Users        |    Version:
 Severity:  minor        |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 `wp_new_user_notification` is a pluggable function allowing some amount of
 filtering.
 The existing filter to allow content filtering but there is no way to
 fully prevent the mail from being sent.
 For example in a case where an external component / plugin handles the
 notification mail for users with a certain role.

 Using the plugable mechanism would require one to copy the complete
 function just to decide whether to send the mail or not.

 This could be easily done by adding a `$send` flag to the already
 filterable `$wp_new_user_notification_email_admin` and
 `$wp_new_user_notification_email`.

 Based on this a filter function can set this flag to `false`.
 Currently the only way to do this is by emptying the `to` address in this
 filter which leads to `wp_mail` errors due to missing receipient.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54874>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list