Only show "Add New Theme" block on Manage Themes screen if not Multisite and the user can install themes.

props markoheijnen.
see #25948.

git-svn-id: https://develop.svn.wordpress.org/trunk@26288 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-11-20 14:08:17 +00:00
parent 09fa0c09bb
commit 863cec8252
2 changed files with 6 additions and 3 deletions

View File

@ -465,7 +465,9 @@ themes.view.Themes = wp.Backbone.View.extend({
});
// 'Add new theme' element shown at the end of the grid
this.$el.append( '<div id="add-new" class="theme add-new"><a href="' + themes.data.settings.install_uri + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + themes.data.i18n.add_new + '</h3></a></div>' );
if ( themes.data.settings.canInstall ) {
this.$el.append( '<div id="add-new" class="theme add-new"><a href="' + themes.data.settings.installURI + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + themes.data.i18n.addNew + '</h3></a></div>' );
}
this.parent.page++;
},

View File

@ -91,7 +91,8 @@ if ( current_user_can( 'switch_themes' ) ) {
wp_localize_script( 'theme', '_wpThemeSettings', array(
'themes' => $themes,
'settings' => array(
'install_uri' => admin_url( 'theme-install.php' ),
'canInstall' => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
'installURI' => admin_url( 'theme-install.php' ),
'customizeURI' => ( current_user_can( 'edit_theme_options' ) ) ? wp_customize_url() : null,
'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
'root' => '/wp-admin/themes.php',
@ -99,7 +100,7 @@ wp_localize_script( 'theme', '_wpThemeSettings', array(
'extraRoutes' => '',
),
'i18n' => array(
'add_new' => __( 'Add New Theme' ),
'addNew' => __( 'Add New Theme' ),
),
) );