#42134 closed enhancement (fixed)
Add filter to emails sent by wp-admin/network/site-new.php
Reported by: | johnbillion | Owned by: | johnbillion |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | good-first-bug has-patch commit has-dev-note |
Focuses: | multisite | Cc: |
Description
wp-admin/network/site-new.php
contains a call to wp_mail()
which sends an email when a new site is created from Network Admin -> Sites -> Add New on Multisite. (Ref).
The contents of the email cannot be filtered. The recipient, subject, message, and headers should be passed through a filter in the same format as the password_change_email
filter. (Ref).
Attachments (4)
Change History (25)
@
7 years ago
Added a filter for filtering the contents of the email sent when a new site is created.
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
7 years ago
@
6 years ago
added the feature simmilar to wp_welcome_message(). E.g. Filter 'wpmu_admin_notification' to disable or bypass. Filter 'update_admin_notification' and 'update_admin_notification_subject'} to modify the content and subject line of the notification email.
#8
@
5 years ago
- Keywords needs-testing added
- Milestone changed from 5.2 to 5.3
These patches need to be reviewed and tested.
#9
@
5 years ago
Looking at the code I'm seeing some places that can be improved. As this is a stand-alone function better checking for unexpected situation will improve functionality.
get_userdata
can return unexpected data, as the user ID doesn't have to be valid$admin_notification
is being determined using a filter, which can return an empty value; an email should not be send if there is no message
Site tite:
Title is being provided as an argument to the function, but $current_network->site_name
is being used instead.
In this implementation $current_network->site_name
is being set to a value, this might have unwanted side-effects.
Some other concern I noticed:
The admin_email will be default in this patch to: 'support@' . $_SERVER['SERVER_NAME']
But support is not a default emailbox. Suggesting to use "postmaster" or even considering of returning a WP_Error and not sending an email at all.
This ticket was mentioned in Slack in #core by sergey. View the logs.
5 years ago
#12
@
5 years ago
- Keywords needs-refresh added
- Milestone changed from 5.3 to Future Release
This still needs some work. With 5.3 beta 1 in a few hours, it needs to be punted.
#15
@
4 years ago
- Keywords commit added
42134.diff continues on from the patches here and on #42135.
- Improved naming and structure of the filters
- Avoid passing unnecessary parameters such as the site title, as this can be gotten from the site option
- Pass the complete site and user objects to the filters
- Correctly switch to the locale of the user associated with the network admin email address, falling back to the locale of the site if there isn't one
This is looking good to me now.
#19
@
4 years ago
- Keywords needs-dev-note added
Let's note this new filter in the miscellaneous dev note.
Related: #42135