From 8662725a4bb5f384c188e12342f9257ead5e93a5 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 23 Jan 2018 13:47:40 +0000 Subject: [PATCH] Email: Don't send notifications for site or network admin email address change to the default 'admin_email' value. Props tigertech, MattyRob, seanchayes. Merges [42570] to the 4.9 branch. Fixes #42693. Built from https://develop.svn.wordpress.org/branches/4.9@42571 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42400 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 9 ++++++++- wp-includes/ms-functions.php | 9 ++++++++- wp-includes/version.php | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 56fc4040e0..da9f6326a1 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -5738,6 +5738,13 @@ function wp_cache_get_last_changed( $group ) { * @param string $option_name The relevant database option name. */ function wp_site_admin_email_change_notification( $old_email, $new_email, $option_name ) { + $send = true; + + // Don't send the notification to the default 'admin_email' value. + if ( 'you@example.com' === $old_email ) { + $send = false; + } + /** * Filters whether to send the site admin email change notification email. * @@ -5747,7 +5754,7 @@ function wp_site_admin_email_change_notification( $old_email, $new_email, $optio * @param string $old_email The old site admin email address. * @param string $new_email The new site admin email address. */ - $send = apply_filters( 'send_site_admin_email_change_email', true, $old_email, $new_email ); + $send = apply_filters( 'send_site_admin_email_change_email', $send, $old_email, $new_email ); if ( ! $send ) { return; diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 4a6f0ed0ae..2289ad3381 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -2662,6 +2662,13 @@ All at ###SITENAME### * @param int $network_id ID of the network. */ function wp_network_admin_email_change_notification( $option_name, $new_email, $old_email, $network_id ) { + $send = true; + + // Don't send the notification to the default 'admin_email' value. + if ( 'you@example.com' === $old_email ) { + $send = false; + } + /** * Filters whether to send the network admin email change notification email. * @@ -2672,7 +2679,7 @@ function wp_network_admin_email_change_notification( $option_name, $new_email, $ * @param string $new_email The new network admin email address. * @param int $network_id ID of the network. */ - $send = apply_filters( 'send_network_admin_email_change_email', true, $old_email, $new_email, $network_id ); + $send = apply_filters( 'send_network_admin_email_change_email', $send, $old_email, $new_email, $network_id ); if ( ! $send ) { return; diff --git a/wp-includes/version.php b/wp-includes/version.php index 2275be6258..d5e63467c8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.3-alpha-42569'; +$wp_version = '4.9.3-alpha-42571'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.