From 9b88439cb62888817701478d7068738fd2509fc4 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 7 Jan 2011 19:01:34 +0000 Subject: [PATCH] Fix net admin theme deletion over FTP. see #16117 git-svn-id: http://svn.automattic.com/wordpress/trunk@17237 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/theme.php | 8 +++++--- wp-admin/network/themes.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index b63d241f92..ecddb5b96b 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -43,17 +43,19 @@ function current_theme_info() { * @since 2.8.0 * * @param string $template Template directory of the theme to delete + * @param string $redirect Redirect to page when complete. * @return mixed */ -function delete_theme($template) { +function delete_theme($template, $redirect = '') { global $wp_filesystem; if ( empty($template) ) return false; ob_start(); - $url = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); - if ( false === ($credentials = request_filesystem_credentials($url)) ) { + if ( empty( $redirect ) ) + $redirect = wp_nonce_url('themes.php?action=delete&template=' . $template, 'delete-theme_' . $template); + if ( false === ($credentials = request_filesystem_credentials($redirect)) ) { $data = ob_get_contents(); ob_end_clean(); if ( ! empty($data) ){ diff --git a/wp-admin/network/themes.php b/wp-admin/network/themes.php index 728a3a9dd6..ade1c1d772 100644 --- a/wp-admin/network/themes.php +++ b/wp-admin/network/themes.php @@ -160,7 +160,7 @@ if ( $action ) { } // Endif verify-delete foreach ( $themes as $theme ) - $delete_result = delete_theme( $theme ); + $delete_result = delete_theme( $theme, esc_url( add_query_arg( array('verify-delete' => 1), $_SERVER['REQUEST_URI'] ) ) ); wp_redirect( add_query_arg( 'deleted', count( $themes ), $referer ) ); exit; break;