diff --git wp-admin/themes.php wp-admin/themes.php
index c02c17a..0291cfb 100644
|
|
if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { |
22 | 22 | check_admin_referer('switch-theme_' . $_GET['stylesheet']); |
23 | 23 | $theme = wp_get_theme( $_GET['stylesheet'] ); |
24 | 24 | |
25 | | if ( ! $theme->exists() || ! $theme->is_allowed() ) { |
| 25 | if ( ! $theme->exists() ) { |
26 | 26 | wp_die( |
27 | 27 | '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
28 | 28 | '<p>' . __( 'The requested theme does not exist.' ) . '</p>', |
… |
… |
if ( current_user_can( 'switch_themes' ) && isset($_GET['action'] ) ) { |
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
| 33 | if ( ! $theme->is_allowed() && current_user_can( 'manage_network_themes' ) ) { |
| 34 | WP_Theme::network_enable_theme( $theme->get_stylesheet() ); |
| 35 | } |
| 36 | |
33 | 37 | switch_theme( $theme->get_stylesheet() ); |
34 | 38 | wp_redirect( admin_url('themes.php?activated=true') ); |
35 | 39 | exit; |
… |
… |
get_current_screen()->set_help_sidebar( |
119 | 123 | '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
120 | 124 | ); |
121 | 125 | |
122 | | if ( current_user_can( 'switch_themes' ) ) { |
| 126 | if ( current_user_can( 'manage_network_themes' ) ) { |
| 127 | // Display all themes to allow network administrator who can manage themes to network activate it |
| 128 | $themes = wp_prepare_themes_for_js( wp_get_themes() ); |
| 129 | } else if ( current_user_can( 'switch_themes' ) ) { |
| 130 | // Display only allowed themes |
123 | 131 | $themes = wp_prepare_themes_for_js(); |
124 | 132 | } else { |
125 | 133 | $themes = wp_prepare_themes_for_js( array( wp_get_theme() ) ); |