From 972900cf3e34fce0c358a9d9cab453651472befa Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 26 Apr 2010 17:55:41 +0000 Subject: [PATCH] Allow regular admins to change the admin email. see #13126 git-svn-id: https://develop.svn.wordpress.org/trunk@14241 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/options.php | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/wp-admin/options.php b/wp-admin/options.php index 100972eebf..c618b92466 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -30,6 +30,27 @@ if ( empty($option_page) ) // This is for back compat and will eventually be rem if ( !current_user_can('manage_options') ) wp_die(__('Cheatin’ uh?')); +// Handle admin email change requests +if ( is_multisite() ) { + 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' ); + wp_redirect( admin_url( 'options-general.php?updated=true' ) ); + exit; + } +} + if ( is_multisite() && !is_super_admin() && 'update' != $action ) wp_die(__('Cheatin’ uh?')); @@ -72,26 +93,6 @@ if ( !is_multisite() ) { $whitelist_options = apply_filters( 'whitelist_options', $whitelist_options ); -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' ); - wp_redirect( admin_url( 'options-general.php?updated=true' ) ); - exit; - } -} - /* * If $_GET['action'] == 'update' we are saving settings sent from a settings page */