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
This commit is contained in:
parent
24b7698dbf
commit
972900cf3e
|
@ -30,6 +30,27 @@ if ( empty($option_page) ) // This is for back compat and will eventually be rem
|
||||||
if ( !current_user_can('manage_options') )
|
if ( !current_user_can('manage_options') )
|
||||||
wp_die(__('Cheatin’ uh?'));
|
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 )
|
if ( is_multisite() && !is_super_admin() && 'update' != $action )
|
||||||
wp_die(__('Cheatin’ uh?'));
|
wp_die(__('Cheatin’ uh?'));
|
||||||
|
|
||||||
|
@ -72,26 +93,6 @@ if ( !is_multisite() ) {
|
||||||
|
|
||||||
$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
|
$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
|
* If $_GET['action'] == 'update' we are saving settings sent from a settings page
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue