From cb22e5b10a221b8c8d7ffc847e9183b2e18dcd2a Mon Sep 17 00:00:00 2001 From: nacin Date: Mon, 15 Mar 2010 17:18:00 +0000 Subject: [PATCH] Only show multisite admin email notice if the email was changed. Add a "Cancel" link so the nag doesn't stay forever if the admin ends up not changing the email. see #12192 git-svn-id: http://svn.automattic.com/wordpress/trunk@13705 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options-general.php | 5 +++-- wp-admin/options.php | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index 822849c592..5edab2e19c 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -106,9 +106,10 @@ include('./admin-header.php'); The new address will not become active until confirmed.') ?> +$new_admin_email = get_option( 'new_admin_email' ); +if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?>
-

%s.'), $new_admin_email ); ?>

+

%1$s. Cancel'), $new_admin_email, esc_url( admin_url( 'options.php?dismiss=new_admin_email' ) ) ); ?>

diff --git a/wp-admin/options.php b/wp-admin/options.php index dc8e165078..c7d6fc11b6 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -75,17 +75,24 @@ if ( !is_multisite() ) { $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); -if ( is_multisite() && is_super_admin() && !empty($_GET[ 'adminhash' ]) ) { - $new_admin_details = get_option( 'adminhash' ); - $redirect = admin_url('options-general.php?updated=false'); - if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) { - update_option( 'admin_email', $new_admin_details[ 'newemail' ] ); +if ( is_multisite() && is_super_admin() ) { + if ( ! empty($_GET[ 'adminhash' ] ) ) { + $new_admin_details = get_option( 'adminhash' ); + $redirect = 'options-general.php?updated=false'; + if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) { + update_option( 'admin_email', $new_admin_details[ 'newemail' ] ); + delete_option( 'adminhash' ); + delete_option( 'new_admin_email' ); + $redirect = 'options-general.php?updated=true'; + } + wp_redirect( admin_url( $redirect ) ); + exit; + } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) { delete_option( 'adminhash' ); delete_option( 'new_admin_email' ); - $redirect = admin_url('options-general.php?updated=true'); + wp_redirect( admin_url( 'options-general.php?updated=true' ) ); + exit; } - wp_redirect( $redirect); - exit; } /**