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
This commit is contained in:
nacin 2010-03-15 17:18:00 +00:00
parent f635d99754
commit cb22e5b10a
2 changed files with 18 additions and 10 deletions

View File

@ -106,9 +106,10 @@ include('./admin-header.php');
<td><input name="new_admin_email" type="text" id="new_admin_email" value="<?php form_option('admin_email'); ?>" class="regular-text code" />
<span class="setting-description"><?php _e('This address is used for admin purposes. If you change this we will send you an e-mail at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>') ?></span>
<?php
if ( $new_admin_email = get_option( 'new_admin_email' ) ) : ?>
$new_admin_email = get_option( 'new_admin_email' );
if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?>
<div class="updated inline">
<p><?php printf( __('There is a pending change of the admin e-mail to <code>%s</code>.'), $new_admin_email ); ?></p>
<p><?php printf( __('There is a pending change of the admin e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_admin_email, esc_url( admin_url( 'options.php?dismiss=new_admin_email' ) ) ); ?></p>
</div>
<?php endif; ?>
</td>

View File

@ -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;
}
/**