Make WordPress Core


Ignore:
Timestamp:
07/14/2014 07:00:24 PM (12 years ago)
Author:
ocean90
Message:

Customizer: Add meta capability customize which is mapped to edit_theme_options.

You can now allow users to access the Customizer, say for any user who can edit_posts, via map_meta_cap or user_has_cap filter. See ticket for examples.

props westonruter, nacin.
fixes #28605.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/admin-bar.php

    r28969 r29170  
    661661                return;
    662662
    663         $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    664         $wp_admin_bar->add_menu( array(
    665                 'parent' => 'appearance',
    666                 'id'     => 'customize',
    667                 'title'  => __('Customize'),
    668                 'href'   => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
    669                 'meta'   => array(
    670                         'class' => 'hide-if-no-customize',
    671                 ),
    672         ) );
    673         add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
     663        if ( current_user_can( 'customize' ) ) {
     664                $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     665                $wp_admin_bar->add_menu( array(
     666                        'parent' => 'appearance',
     667                        'id'     => 'customize',
     668                        'title'  => __('Customize'),
     669                        'href'   => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
     670                        'meta'   => array(
     671                                'class' => 'hide-if-no-customize',
     672                        ),
     673                ) );
     674                add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
     675        }
    674676
    675677        if ( current_theme_supports( 'widgets' )  )
Note: See TracChangeset for help on using the changeset viewer.