[wp-trac] [WordPress Trac] #36970: wp_new_user_notification disable admin email but allow user email

WordPress Trac noreply at wordpress.org
Sun May 29 20:48:19 UTC 2016


#36970: wp_new_user_notification disable admin email but allow user email
-------------------------+-----------------------------
 Reporter:  jshrek       |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 I would like to suggest a simple patch to the wp_new_user_notification
 function that would allow you send the user their email but disable to
 admin notification email.

 Currently you can either send an email to both the user and the admin, or
 the admin only but there is no option to send email to the user only.

 So currently if I look at source:tags/4.5/src/wp-includes/pluggable.php at
 line 1719 we have this line which sends the email to the admin:
 {{{#!php
 <?php
 @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User
 Registration'), $blogname), $message);
 }}}

 My suggestion is as follows:
 {{{#!php
 <?php
     //Allow ability to disable email to admin but still send email to the
 user.
     // If $notify is 'admin' then email will only be sent to admin user
 but not to user.
     // If $notify is 'both' then email will be sent to admin and to user.
     // If $notify is '' (blank) then email will be sent to admin and to
 user.
     // If $notify is anything else (like 'user') then email will only be
 sent to user but not to admin.
     if ('admin' === $notify || 'both' === $notify || '' === $notify) {
        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User
 Registration'), $blogname), $message);
     }
 }}}

 Not sure how I can submit this patch, but I have attached the function
 with the changes.

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


More information about the wp-trac mailing list