Use the stylesheet rather than the template to create the network enable theme nonce. Fix network enable redirect following theme installation. Props duck_, nacin. fixes #20916

git-svn-id: https://develop.svn.wordpress.org/trunk@21062 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2012-06-12 15:31:25 +00:00
parent d81496ca18
commit d0e8e5ca35
2 changed files with 5 additions and 2 deletions

View File

@ -1521,7 +1521,7 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . $template, 'enable-theme_' . $template ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . $stylesheet, 'enable-theme_' . $stylesheet ) ) . '" title="' . esc_attr__( 'Enable this theme for all sites in this network' ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
if ( $this->type == 'web' )
$install_actions['themes_page'] = '<a href="' . self_admin_url('theme-install.php') . '" title="' . esc_attr__('Return to Theme Installer') . '" target="_parent">' . __('Return to Theme Installer') . '</a>';

View File

@ -40,7 +40,10 @@ if ( $action ) {
check_admin_referer('enable-theme_' . $_GET['theme']);
$allowed_themes[ $_GET['theme'] ] = true;
update_site_option( 'allowedthemes', $allowed_themes );
wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );
if ( false === strpos( $referer, '/network/themes.php' ) )
wp_redirect( network_admin_url( 'themes.php?enabled=1' ) );
else
wp_safe_redirect( add_query_arg( 'enabled', 1, $referer ) );
exit;
break;
case 'disable':