mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@29170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -12,7 +12,7 @@ define( 'IFRAME_REQUEST', true );
|
||||
/** Load WordPress Administration Bootstrap */
|
||||
require_once( dirname( __FILE__ ) . '/admin.php' );
|
||||
|
||||
if ( ! current_user_can( 'edit_theme_options' ) ) {
|
||||
if ( ! current_user_can( 'customize' ) ) {
|
||||
wp_die( __( 'Cheatin’ uh?' ) );
|
||||
}
|
||||
|
||||
@@ -24,7 +24,13 @@ if ( $return ) {
|
||||
$return = wp_validate_redirect( $return );
|
||||
}
|
||||
if ( ! $return ) {
|
||||
$return = $url;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
global $wp_scripts, $wp_customize;
|
||||
@@ -112,7 +118,7 @@ do_action( 'customize_controls_print_scripts' );
|
||||
submit_button( $save_text, 'primary save', 'save', false );
|
||||
?>
|
||||
<span class="spinner"></span>
|
||||
<a class="customize-controls-close" href="<?php echo esc_url( $return ? $return : admin_url( 'themes.php' ) ); ?>">
|
||||
<a class="customize-controls-close" href="<?php echo esc_url( $return ); ?>">
|
||||
<span class="screen-reader-text"><?php _e( 'Cancel' ); ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user