Make WordPress Core

Changeset 26288


Ignore:
Timestamp:
11/20/2013 02:08:17 PM (12 years ago)
Author:
SergeyBiryukov
Message:

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

props markoheijnen.
see #25948.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/theme.js

    r26141 r26288  
    466466
    467467        // 'Add new theme' element shown at the end of the grid
    468         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>' );
     468        if ( themes.data.settings.canInstall ) {
     469            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>' );
     470        }
    469471
    470472        this.parent.page++;
  • trunk/src/wp-admin/themes.php

    r26282 r26288  
    9292    'themes'   => $themes,
    9393    'settings' => array(
    94         'install_uri'   => admin_url( 'theme-install.php' ),
     94        'canInstall'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
     95        'installURI'    => admin_url( 'theme-install.php' ),
    9596        'customizeURI'  => ( current_user_can( 'edit_theme_options' ) ) ? wp_customize_url() : null,
    9697        'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ),
     
    100101    ),
    101102    'i18n' => array(
    102         'add_new'         => __( 'Add New Theme' ),
     103        'addNew'        => __( 'Add New Theme' ),
    103104    ),
    104105) );
Note: See TracChangeset for help on using the changeset viewer.