<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29170] trunk/src: Customizer: Add meta capability `customize` which is mapped to `edit_theme_options`.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29170">29170</a></dd>
<dt>Author</dt> <dd>ocean90</dd>
<dt>Date</dt> <dd>2014-07-14 19:00:24 +0000 (Mon, 14 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>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 <a href="http://core.trac.wordpress.org/ticket/28605">#28605</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminadminheaderphp">trunk/src/wp-admin/admin-header.php</a></li>
<li><a href="#trunksrcwpadmincustomizephp">trunk/src/wp-admin/customize.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpthemeslisttablephp">trunk/src/wp-admin/includes/class-wp-themes-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpupgraderskinsphp">trunk/src/wp-admin/includes/class-wp-upgrader-skins.php</a></li>
<li><a href="#trunksrcwpadminincludesdashboardphp">trunk/src/wp-admin/includes/dashboard.php</a></li>
<li><a href="#trunksrcwpadminincludesthemephp">trunk/src/wp-admin/includes/theme.php</a></li>
<li><a href="#trunksrcwpadminmenuphp">trunk/src/wp-admin/menu.php</a></li>
<li><a href="#trunksrcwpadminthemesphp">trunk/src/wp-admin/themes.php</a></li>
<li><a href="#trunksrcwpincludesadminbarphp">trunk/src/wp-includes/admin-bar.php</a></li>
<li><a href="#trunksrcwpincludescapabilitiesphp">trunk/src/wp-includes/capabilities.php</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizemanagerphp">trunk/src/wp-includes/class-wp-customize-manager.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminadminheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/admin-header.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/admin-header.php      2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/admin-header.php 2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -177,8 +177,9 @@
</span><span class="cx"> 
</span><span class="cx"> <?php
</span><span class="cx"> // Make sure the customize body classes are correct as early as possible.
</span><del>-if ( current_user_can( 'edit_theme_options' ) )
</del><ins>+if ( current_user_can( 'customize' ) ) {
</ins><span class="cx">   wp_customize_support_script();
</span><ins>+}
</ins><span class="cx"> ?>
</span><span class="cx"> 
</span><span class="cx"> <div id="wpwrap">
</span></span></pre></div>
<a id="trunksrcwpadmincustomizephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/customize.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/customize.php 2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/customize.php    2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx"> /** Load WordPress Administration Bootstrap */
</span><span class="cx"> require_once( dirname( __FILE__ ) . '/admin.php' );
</span><span class="cx"> 
</span><del>-if ( ! current_user_can( 'edit_theme_options' ) ) {
</del><ins>+if ( ! current_user_can( 'customize' ) ) {
</ins><span class="cx">   wp_die( __( 'Cheatin&#8217; uh?' ) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -24,7 +24,13 @@
</span><span class="cx">  $return = wp_validate_redirect( $return );
</span><span class="cx"> }
</span><span class="cx"> if ( ! $return ) {
</span><del>-       $return = $url;
</del><ins>+        if ( $url ) {
+               $return = $url;
+       } elseif ( current_user_can( 'edit_theme_options' ) || current_user_can( 'switch_themes' ) ) {
+               $return = admin_url( 'themes.php' );
+       } else {
+               $return = admin_url();
+       }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> global $wp_scripts, $wp_customize;
</span><span class="lines">@@ -112,7 +118,7 @@
</span><span class="cx">                          submit_button( $save_text, 'primary save', 'save', false );
</span><span class="cx">                  ?>
</span><span class="cx">                  <span class="spinner"></span>
</span><del>-                       <a class="customize-controls-close" href="<?php echo esc_url( $return ? $return : admin_url( 'themes.php' ) ); ?>">
</del><ins>+                        <a class="customize-controls-close" href="<?php echo esc_url( $return ); ?>">
</ins><span class="cx">                           <span class="screen-reader-text"><?php _e( 'Cancel' ); ?></span>
</span><span class="cx">                  </a>
</span><span class="cx">          </div>
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpthemeslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-themes-list-table.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-themes-list-table.php       2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/includes/class-wp-themes-list-table.php  2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -149,9 +149,10 @@
</span><span class="cx">                  $actions['preview'] = '<a href="' . $preview_link . '" class="hide-if-customize" title="'
</span><span class="cx">                          . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Preview' ) . '</a>';
</span><span class="cx"> 
</span><del>-                       if ( current_user_can( 'edit_theme_options' ) )
</del><ins>+                        if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
</ins><span class="cx">                           $actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
</span><span class="cx">                                  . __( 'Live Preview' ) . '</a>';
</span><ins>+                       }
</ins><span class="cx"> 
</span><span class="cx">                  if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
</span><span class="cx">                          $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpupgraderskinsphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-upgrader-skins.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-upgrader-skins.php  2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/includes/class-wp-upgrader-skins.php     2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -522,7 +522,9 @@
</span><span class="cx"> 
</span><span class="cx">          $install_actions = array();
</span><span class="cx">          $install_actions['preview']  = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Preview') . '</a>';
</span><del>-               $install_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Live Preview') . '</a>';
</del><ins>+                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+                       $install_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Live Preview') . '</a>';
+               }
</ins><span class="cx">           $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
</span><span class="cx"> 
</span><span class="cx">          if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
</span><span class="lines">@@ -594,11 +596,14 @@
</span><span class="cx">                  $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
</span><span class="cx"> 
</span><span class="cx">                  if ( get_stylesheet() == $stylesheet ) {
</span><del>-                               if ( current_user_can( 'edit_theme_options' ) )
</del><ins>+                                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
</ins><span class="cx">                                   $update_actions['preview']  = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Customize &#8220;%s&#8221;'), $name ) ) . '">' . __('Customize') . '</a>';
</span><ins>+                               }
</ins><span class="cx">                   } elseif ( current_user_can( 'switch_themes' ) ) {
</span><span class="cx">                          $update_actions['preview']  = '<a href="' . esc_url( $preview_link ) . '" class="hide-if-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Preview') . '</a>';
</span><del>-                               $update_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Live Preview') . '</a>';
</del><ins>+                                if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
+                                       $update_actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize" title="' . esc_attr( sprintf( __('Preview &#8220;%s&#8221;'), $name ) ) . '">' . __('Live Preview') . '</a>';
+                               }
</ins><span class="cx">                           $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate &#8220;%s&#8221;'), $name ) ) . '">' . __('Activate') . '</a>';
</span><span class="cx">                  }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpadminincludesdashboardphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/dashboard.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/dashboard.php        2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/includes/dashboard.php   2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -1279,8 +1279,10 @@
</span><span class="cx">  <p class="about-description"><?php _e( 'We&#8217;ve assembled some links to get you started:' ); ?></p>
</span><span class="cx">  <div class="welcome-panel-column-container">
</span><span class="cx">  <div class="welcome-panel-column">
</span><del>-               <h4><?php _e( 'Get Started' ); ?></h4>
-               <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
</del><ins>+                <?php if ( current_user_can( 'customize' ) ): ?>
+                       <h4><?php _e( 'Get Started' ); ?></h4>
+                       <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
+               <?php endif; ?>
</ins><span class="cx">           <a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
</span><span class="cx">          <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
</span><span class="cx">                  <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p>
</span></span></pre></div>
<a id="trunksrcwpadminincludesthemephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/theme.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/theme.php    2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/includes/theme.php       2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -430,7 +430,7 @@
</span><span class="cx">                  'update'       => get_theme_update_available( $theme ),
</span><span class="cx">                  'actions'      => array(
</span><span class="cx">                          'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&amp;stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null,
</span><del>-                               'customize'=> current_user_can( 'edit_theme_options' ) ? wp_customize_url( $slug ) : null,
</del><ins>+                                'customize' => ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) ? wp_customize_url( $slug ) : null,
</ins><span class="cx">                           'preview'   => add_query_arg( array(
</span><span class="cx">                                  'preview'        => 1,
</span><span class="cx">                                  'template'       => urlencode( $theme->get_template() ),
</span></span></pre></div>
<a id="trunksrcwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/menu.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/menu.php      2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/menu.php 2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx">  $submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
</span><span class="cx"> 
</span><span class="cx">  $customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
</span><del>-       $submenu['themes.php'][6] = array( __( 'Customize' ), 'edit_theme_options', $customize_url, '', 'hide-if-no-customize' );
</del><ins>+        $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', $customize_url, '', 'hide-if-no-customize' );
</ins><span class="cx">   unset( $customize_url );
</span><span class="cx">  if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
</span><span class="cx">          $submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php');
</span></span></pre></div>
<a id="trunksrcwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/themes.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/themes.php    2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-admin/themes.php       2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx"> } // install_themes
</span><span class="cx"> 
</span><span class="cx"> // Help tab: Previewing and Customizing
</span><del>-if ( current_user_can( 'edit_theme_options' ) ) {
</del><ins>+if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
</ins><span class="cx">   $help_customize =
</span><span class="cx">          '<p>' . __( 'Tap or hover on any theme then click the Live Preview button to see a live preview of that theme and change theme options in a separate, full-screen view. You can also find a Live Preview button at the bottom of the theme details screen. Any installed theme can be previewed and customized in this way.' ) . '</p>'.
</span><span class="cx">          '<p>' . __( 'The theme being previewed is fully interactive &mdash; navigate to different pages to see how the theme handles posts, archives, and other page templates. The settings may differ depending on what theme features the theme being previewed supports. To accept the new settings and activate the theme all in one step, click the Save &amp; Activate button above the menu.' ) . '</p>' .
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">          'title'         => __( 'Previewing and Customizing' ),
</span><span class="cx">          'content'       => $help_customize
</span><span class="cx">  ) );
</span><del>-} // edit_theme_options
</del><ins>+} // edit_theme_options && customize
</ins><span class="cx"> 
</span><span class="cx"> get_current_screen()->set_help_sidebar(
</span><span class="cx">  '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
</span><span class="lines">@@ -212,13 +212,15 @@
</span><span class="cx">  <div class="theme-actions">
</span><span class="cx"> 
</span><span class="cx">  <?php if ( $theme['active'] ) { ?>
</span><del>-               <?php if ( $theme['actions']['customize'] ) { ?>
</del><ins>+                <?php if ( $theme['actions']['customize'] && current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
</ins><span class="cx">                   <a class="button button-primary customize load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Customize' ); ?></a>
</span><span class="cx">          <?php } ?>
</span><span class="cx">  <?php } else { ?>
</span><span class="cx">          <a class="button button-primary activate" href="<?php echo $theme['actions']['activate']; ?>"><?php _e( 'Activate' ); ?></a>
</span><del>-               <a class="button button-secondary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
-               <a class="button button-secondary hide-if-customize" href="<?php echo $theme['actions']['preview']; ?>"><?php _e( 'Preview' ); ?></a>
</del><ins>+                <?php if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { ?>
+                       <a class="button button-secondary load-customize hide-if-no-customize" href="<?php echo $theme['actions']['customize']; ?>"><?php _e( 'Live Preview' ); ?></a>
+                       <a class="button button-secondary hide-if-customize" href="<?php echo $theme['actions']['preview']; ?>"><?php _e( 'Preview' ); ?></a>
+               <?php } ?>
</ins><span class="cx">   <?php } ?>
</span><span class="cx"> 
</span><span class="cx">  </div>
</span></span></pre></div>
<a id="trunksrcwpincludesadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/admin-bar.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/admin-bar.php      2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-includes/admin-bar.php 2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -660,17 +660,19 @@
</span><span class="cx">  if ( ! current_user_can( 'edit_theme_options' ) )
</span><span class="cx">          return;
</span><span class="cx"> 
</span><del>-       $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
-       $wp_admin_bar->add_menu( array(
-               'parent' => 'appearance',
-               'id'     => 'customize',
-               'title'  => __('Customize'),
-               'href'   => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
-               'meta'   => array(
-                       'class' => 'hide-if-no-customize',
-               ),
-       ) );
-       add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
</del><ins>+        if ( current_user_can( 'customize' ) ) {
+               $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
+               $wp_admin_bar->add_menu( array(
+                       'parent' => 'appearance',
+                       'id'     => 'customize',
+                       'title'  => __('Customize'),
+                       'href'   => add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ),
+                       'meta'   => array(
+                               'class' => 'hide-if-no-customize',
+                       ),
+               ) );
+               add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
+       }
</ins><span class="cx"> 
</span><span class="cx">  if ( current_theme_supports( 'widgets' )  )
</span><span class="cx">          $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'widgets', 'title' => __('Widgets'), 'href' => admin_url('widgets.php') ) );
</span></span></pre></div>
<a id="trunksrcwpincludescapabilitiesphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/capabilities.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/capabilities.php   2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-includes/capabilities.php      2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -1306,6 +1306,9 @@
</span><span class="cx">          else
</span><span class="cx">                  $caps[] = 'do_not_allow';
</span><span class="cx">          break;
</span><ins>+       case 'customize' :
+               $caps[] = 'edit_theme_options';
+               break;
</ins><span class="cx">   default:
</span><span class="cx">          // Handle meta capabilities for custom post types.
</span><span class="cx">          $post_type_meta_caps = _post_type_meta_capabilities();
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizemanagerphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/class-wp-customize-manager.php (29169 => 29170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/class-wp-customize-manager.php     2014-07-14 17:48:48 UTC (rev 29169)
+++ trunk/src/wp-includes/class-wp-customize-manager.php        2014-07-14 19:00:24 UTC (rev 29170)
</span><span class="lines">@@ -157,8 +157,9 @@
</span><span class="cx"> 
</span><span class="cx">          show_admin_bar( false );
</span><span class="cx"> 
</span><del>-               if ( ! current_user_can( 'edit_theme_options' ) )
</del><ins>+                if ( ! current_user_can( 'customize' ) ) {
</ins><span class="cx">                   $this->wp_die( -1 );
</span><ins>+               }
</ins><span class="cx"> 
</span><span class="cx">          $this->original_stylesheet = get_stylesheet();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>