[wp-trac] [WordPress Trac] #26317: Added Filter to be possible to disable/change the 'New Site Created' email sent to Administration email address

WordPress Trac noreply at wordpress.org
Fri Nov 29 11:59:53 UTC 2013


#26317: Added Filter to be possible to disable/change the 'New Site Created' email
sent to Administration email address
-------------------------+-----------------------------
 Reporter:  vaurdan      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Multisite    |    Version:  trunk
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 While doing my WordPress work, I found the need of disable all the
 WordPress Multisite notification emails that are sent to the
 administrator. But one mail keep being sent: "[Sitename] New Site
 Created".

 I decided to analyse the core's code, and found that the email was being
 sent on line 91, of wp-admin/network/site-new.php, and there was no filter
 to disable it (it was just a wp_mail call).

 {{{
 #!php
 $content_mail = sprintf( __( 'New site created by %1$s

 Address: %2$s
 Name: %3$s' ), $current_user->user_login , get_site_url( $id ),
 wp_unslash( $title ) );
                 wp_mail( get_site_option('admin_email'), sprintf( __(
 '[%s] New Site Created' ), $current_site->site_name ), $content_mail,
 'From: "Site Admin" <' . get_site_option( 'admin_email' ) . '>' );
 }}}

 Since I guess that this should be filtered, I decided to create a new
 filter, by replacing that lines with a single function call:

 {{{
 #!php
 $user_name = $current_user->user_login;
 $address = get_site_url( $id );

 wpmu_admin_new_site_notification( $user_name, $address, $title );
 }}}

 The new `wpmu_admin_new_site_notification` that I created, is declared on
 wp-includes/ms-functions.php and it as simple as a function that send an
 email to the administrator, and that have three filters:
 `wpmu_admin_new_site_notification` that can be used to bypass the email;
 `update_new_site_notification_email` that can change the content of the
 emaiil; and `update_new_site_notification_subject` that can be used to
 change the subject of the email.

 You can see more details of this on the .patch file I submitted, with
 commented code.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/26317>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list