Networks and Sites: Extract into a new function the email that gets sent to the network administrator when a new site is created, and introduce filters to disable and modify its

contents.

* The `send_new_site_email` filter can be used to disable this email.
* The `new_site_email` filter can be used to modify its contents.

Props Dhruvin, Dharm1025, dharmin16, jipmoors

Fixes #42134


git-svn-id: https://develop.svn.wordpress.org/trunk@49127 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2020-10-11 19:27:21 +00:00
parent 325024011d
commit f14a2dfbba
2 changed files with 115 additions and 25 deletions

View File

@@ -145,31 +145,7 @@ if ( isset( $_REQUEST['action'] ) && 'add-site' === $_REQUEST['action'] ) {
update_user_option( $user_id, 'primary_blog', $id, true );
}
wp_mail(
get_site_option( 'admin_email' ),
sprintf(
/* translators: New site notification email subject. %s: Network title. */
__( '[%s] New Site Created' ),
get_network()->site_name
),
sprintf(
/* translators: New site notification email. 1: User login, 2: Site URL, 3: Site title. */
__(
'New site created by %1$s
Address: %2$s
Name: %3$s'
),
$current_user->user_login,
get_site_url( $id ),
wp_unslash( $title )
),
sprintf(
'From: "%1$s" <%2$s>',
_x( 'Site Admin', 'email "From" field' ),
get_site_option( 'admin_email' )
)
);
wpmu_new_site_admin_notification( $id, $user_id );
wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) );
wp_redirect(
add_query_arg(