Make WordPress Core

Changeset 13705


Ignore:
Timestamp:
03/15/2010 05:18:00 PM (13 years ago)
Author:
nacin
Message:

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

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-general.php

    r13702 r13705  
    107107<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>
    108108<?php
    109 if ( $new_admin_email = get_option( 'new_admin_email' ) ) : ?>
     109$new_admin_email = get_option( 'new_admin_email' );
     110if ( $new_admin_email && $new_admin_email != get_option('admin_email') ) : ?>
    110111<div class="updated inline">
    111 <p><?php printf( __('There is a pending change of the admin e-mail to <code>%s</code>.'), $new_admin_email ); ?></p>
     112<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>
    112113</div>
    113114<?php endif; ?>
  • trunk/wp-admin/options.php

    r13661 r13705  
    7676$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
    7777
    78 if ( is_multisite() && is_super_admin() && !empty($_GET[ 'adminhash' ]) ) {
    79     $new_admin_details = get_option( 'adminhash' );
    80     $redirect = admin_url('options-general.php?updated=false');
    81     if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
    82         update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
     78if ( is_multisite() && is_super_admin() ) {
     79    if ( ! empty($_GET[ 'adminhash' ] ) ) {
     80        $new_admin_details = get_option( 'adminhash' );
     81        $redirect = 'options-general.php?updated=false';
     82        if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
     83            update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
     84            delete_option( 'adminhash' );
     85            delete_option( 'new_admin_email' );
     86            $redirect = 'options-general.php?updated=true';
     87        }
     88        wp_redirect( admin_url( $redirect ) );
     89        exit;
     90    } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
    8391        delete_option( 'adminhash' );
    8492        delete_option( 'new_admin_email' );
    85         $redirect = admin_url('options-general.php?updated=true');
    86     }
    87     wp_redirect( $redirect);
    88     exit;
     93        wp_redirect( admin_url( 'options-general.php?updated=true' ) );
     94        exit;
     95    }
    8996}
    9097
Note: See TracChangeset for help on using the changeset viewer.