Make WordPress Core

Ticket #25948: 25948.check_capability.diff

File 25948.check_capability.diff, 1.2 KB (added by markoheijnen, 12 years ago)

Don't show "Add new theme" block when you don't have the rights

  • wp-admin/themes.php

     
    9797                'root'          => '/wp-admin/themes.php',
    9898                'container'     => '#appearance',
    9999                'extraRoutes'   => '',
     100                'canInstall'    => ( ! is_multisite() && current_user_can( 'install_themes' ) ),
    100101        ),
    101102        'i18n' => array(
    102103                'add_new'         => __( 'Add New Theme' ),
  • wp-admin/js/theme.js

     
    465465                });
    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.install_uri + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + themes.data.i18n.add_new + '</h3></a></div>' );
     470                }
    469471
    470472                this.parent.page++;
    471473        },