diff --git a/wp-admin/network/site-themes.php b/wp-admin/network/site-themes.php index e016660d81..5a94da7dfb 100644 --- a/wp-admin/network/site-themes.php +++ b/wp-admin/network/site-themes.php @@ -43,6 +43,7 @@ if ( $action ) { switch ( $action ) { case 'enable': $theme = $_GET['theme']; + $update = 'enabled'; if ( !$allowed_themes ) $allowed_themes = array( $theme => true ); else @@ -50,37 +51,38 @@ if ( $action ) { break; case 'disable': $theme = $_GET['theme']; + $update = 'disabled'; if ( !$allowed_themes ) $allowed_themes = array(); else unset( $allowed_themes[$theme] ); break; case 'enable-selected': - $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); - if ( empty($themes) ) { - restore_current_blog(); - wp_redirect( wp_get_referer() ); - exit; - } - foreach( (array) $themes as $theme ) - $allowed_themes[ $theme ] = true; + if ( isset( $_POST['checked'] ) ) { + $update = 'enable'; + $themes = (array) $_POST['checked']; + foreach( (array) $themes as $theme ) + $allowed_themes[ $theme ] = true; + } else { + $update = 'error'; + } break; case 'disable-selected': - $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array(); - if ( empty($themes) ) { - restore_current_blog(); - wp_redirect( wp_get_referer() ); - exit; - } - foreach( (array) $themes as $theme ) - unset( $allowed_themes[ $theme ] ); + if ( isset( $_POST['checked'] ) ) { + $update = 'disable'; + $themes = (array) $_POST['checked']; + foreach( (array) $themes as $theme ) + unset( $allowed_themes[ $theme ] ); + } else { + $update = 'error'; + } break; } update_option( 'allowedthemes', $allowed_themes ); restore_current_blog(); - wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message + wp_redirect( add_query_arg( 'update', $update, wp_get_referer() ) ); exit; } @@ -110,7 +112,22 @@ foreach ( $tabs as $tab_id => $tab ) { echo '' . esc_html( $tab['label'] ) . ''; } ?> - +

' . __( 'Theme enabled.' ) . '

'; + break; + case 'disabled': + echo '

' . __( 'Theme disabled.' ) . '

'; + break; + case 'error': + echo '

' . __( 'No theme selected.' ) . '

'; + break; + } +} ?> +