#36970 closed enhancement (duplicate)
wp_new_user_notification disable admin email but allow user email
Reported by: | jshrek | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.6 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
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 @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
My suggestion is as follows:
<?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.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Suggested patch for wp_new_user_notification