Make WordPress Core

Changeset 14241


Ignore:
Timestamp:
04/26/2010 05:55:41 PM (16 years ago)
Author:
ryan
Message:

Allow regular admins to change the admin email. see #13126

File:
1 edited

Legend:

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

    r14139 r14241  
    3131    wp_die(__('Cheatin’ uh?'));
    3232
     33// Handle admin email change requests
     34if ( is_multisite() ) {
     35    if ( ! empty($_GET[ 'adminhash' ] ) ) {
     36        $new_admin_details = get_option( 'adminhash' );
     37        $redirect = 'options-general.php?updated=false';
     38        if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
     39            update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
     40            delete_option( 'adminhash' );
     41            delete_option( 'new_admin_email' );
     42            $redirect = 'options-general.php?updated=true';
     43        }
     44        wp_redirect( admin_url( $redirect ) );
     45        exit;
     46    } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
     47        delete_option( 'adminhash' );
     48        delete_option( 'new_admin_email' );
     49        wp_redirect( admin_url( 'options-general.php?updated=true' ) );
     50        exit;
     51    }
     52}
     53
    3354if ( is_multisite() && !is_super_admin() && 'update' != $action )
    3455    wp_die(__('Cheatin’ uh?'));
     
    7293
    7394$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
    74 
    75 if ( is_multisite() && is_super_admin() ) {
    76     if ( ! empty($_GET[ 'adminhash' ] ) ) {
    77         $new_admin_details = get_option( 'adminhash' );
    78         $redirect = 'options-general.php?updated=false';
    79         if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
    80             update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
    81             delete_option( 'adminhash' );
    82             delete_option( 'new_admin_email' );
    83             $redirect = 'options-general.php?updated=true';
    84         }
    85         wp_redirect( admin_url( $redirect ) );
    86         exit;
    87     } elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
    88         delete_option( 'adminhash' );
    89         delete_option( 'new_admin_email' );
    90         wp_redirect( admin_url( 'options-general.php?updated=true' ) );
    91         exit;
    92     }
    93 }
    9495
    9596/*
Note: See TracChangeset for help on using the changeset viewer.