diff --git src/wp-admin/custom-background.php src/wp-admin/custom-background.php
index 7183576..f65d8c3 100644
|
|
class Custom_Background { |
61 | 61 | * @since 3.0.0 |
62 | 62 | */ |
63 | 63 | public function init() { |
64 | | $page = add_theme_page( __( 'Background' ), __( 'Background' ), 'edit_theme_options', 'custom-background', array( $this, 'admin_page' ) ); |
| 64 | $page = add_theme_page( __( 'Background' ), __( 'Background' ), 'manage_custom_background', 'custom-background', array( $this, 'admin_page' ) ); |
65 | 65 | if ( ! $page ) { |
66 | 66 | return; |
67 | 67 | } |
… |
… |
if ( current_theme_supports( 'custom-background', 'default-color' ) ) |
416 | 416 | public function ajax_background_add() { |
417 | 417 | check_ajax_referer( 'background-add', 'nonce' ); |
418 | 418 | |
419 | | if ( ! current_user_can( 'edit_theme_options' ) ) { |
| 419 | if ( ! current_user_can( 'manage_custom_background' ) ) { |
420 | 420 | wp_send_json_error(); |
421 | 421 | } |
422 | 422 | |
… |
… |
if ( current_theme_supports( 'custom-background', 'default-color' ) ) |
454 | 454 | * @deprecated 3.5.0 |
455 | 455 | */ |
456 | 456 | public function wp_set_background_image() { |
457 | | if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit; |
| 457 | if ( ! current_user_can( 'manage_custom_background' ) || ! isset( $_POST['attachment_id'] ) ) exit; |
458 | 458 | $attachment_id = absint($_POST['attachment_id']); |
459 | 459 | /** This filter is documented in wp-admin/includes/media.php */ |
460 | 460 | $sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) )); |
diff --git src/wp-admin/custom-header.php src/wp-admin/custom-header.php
index 14d3472..d3129fa 100644
|
|
class Custom_Image_Header { |
70 | 70 | * @since 2.1.0 |
71 | 71 | */ |
72 | 72 | public function init() { |
73 | | $page = add_theme_page( __( 'Header' ), __( 'Header' ), 'edit_theme_options', 'custom-header', array( $this, 'admin_page' ) ); |
| 73 | $page = add_theme_page( __( 'Header' ), __( 'Header' ), 'manage_custom_header', 'custom-header', array( $this, 'admin_page' ) ); |
74 | 74 | if ( ! $page ) { |
75 | 75 | return; |
76 | 76 | } |
… |
… |
class Custom_Image_Header { |
184 | 184 | * @since 2.6.0 |
185 | 185 | */ |
186 | 186 | public function take_action() { |
187 | | if ( ! current_user_can('edit_theme_options') ) |
| 187 | if ( ! current_user_can( 'manage_custom_header' ) ) { |
188 | 188 | return; |
| 189 | } |
189 | 190 | |
190 | | if ( empty( $_POST ) ) |
| 191 | if ( empty( $_POST ) ) { |
191 | 192 | return; |
| 193 | } |
192 | 194 | |
193 | 195 | $this->updated = true; |
194 | 196 | |
… |
… |
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> |
916 | 918 | * @since 2.1.0 |
917 | 919 | */ |
918 | 920 | public function admin_page() { |
919 | | if ( ! current_user_can('edit_theme_options') ) |
920 | | wp_die(__('You do not have permission to customize headers.')); |
| 921 | if ( ! current_user_can( 'manage_custom_header' ) ) { |
| 922 | wp_die( __( 'You do not have permission to customize headers.' ) ); |
| 923 | } |
921 | 924 | $step = $this->step(); |
922 | 925 | if ( 2 == $step ) |
923 | 926 | $this->step_2(); |
… |
… |
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> |
1147 | 1150 | public function ajax_header_crop() { |
1148 | 1151 | check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' ); |
1149 | 1152 | |
1150 | | if ( ! current_user_can( 'edit_theme_options' ) ) { |
| 1153 | if ( ! current_user_can( 'manage_custom_header' ) ) { |
1151 | 1154 | wp_send_json_error(); |
1152 | 1155 | } |
1153 | 1156 | |
… |
… |
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> |
1204 | 1207 | public function ajax_header_add() { |
1205 | 1208 | check_ajax_referer( 'header-add', 'nonce' ); |
1206 | 1209 | |
1207 | | if ( ! current_user_can( 'edit_theme_options' ) ) { |
| 1210 | if ( ! current_user_can( 'manage_custom_header' ) ) { |
1208 | 1211 | wp_send_json_error(); |
1209 | 1212 | } |
1210 | 1213 | |
… |
… |
wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?> |
1230 | 1233 | public function ajax_header_remove() { |
1231 | 1234 | check_ajax_referer( 'header-remove', 'nonce' ); |
1232 | 1235 | |
1233 | | if ( ! current_user_can( 'edit_theme_options' ) ) { |
| 1236 | if ( ! current_user_can( 'manage_custom_header' ) ) { |
1234 | 1237 | wp_send_json_error(); |
1235 | 1238 | } |
1236 | 1239 | |
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index f17f1a8..7a72c78 100644
|
|
function wp_ajax_edit_comment() { |
1065 | 1065 | function wp_ajax_add_menu_item() { |
1066 | 1066 | check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); |
1067 | 1067 | |
1068 | | if ( ! current_user_can( 'edit_theme_options' ) ) |
| 1068 | if ( ! current_user_can( 'manage_menus' ) ) { |
1069 | 1069 | wp_die( -1 ); |
| 1070 | } |
1070 | 1071 | |
1071 | 1072 | require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; |
1072 | 1073 | |
… |
… |
function wp_ajax_update_welcome_panel() { |
1342 | 1343 | * @since 3.1.0 |
1343 | 1344 | */ |
1344 | 1345 | function wp_ajax_menu_get_metabox() { |
1345 | | if ( ! current_user_can( 'edit_theme_options' ) ) |
| 1346 | if ( ! current_user_can( 'manage_menus' ) ) { |
1346 | 1347 | wp_die( -1 ); |
| 1348 | } |
1347 | 1349 | |
1348 | 1350 | require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; |
1349 | 1351 | |
… |
… |
function wp_ajax_wp_link_ajax() { |
1416 | 1418 | * @since 3.1.0 |
1417 | 1419 | */ |
1418 | 1420 | function wp_ajax_menu_locations_save() { |
1419 | | if ( ! current_user_can( 'edit_theme_options' ) ) |
| 1421 | if ( ! current_user_can( 'manage_menus' ) ) { |
1420 | 1422 | wp_die( -1 ); |
| 1423 | } |
1421 | 1424 | check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' ); |
1422 | 1425 | if ( ! isset( $_POST['menu-locations'] ) ) |
1423 | 1426 | wp_die( 0 ); |
… |
… |
function wp_ajax_meta_box_order() { |
1461 | 1464 | * @since 3.1.0 |
1462 | 1465 | */ |
1463 | 1466 | function wp_ajax_menu_quick_search() { |
1464 | | if ( ! current_user_can( 'edit_theme_options' ) ) |
| 1467 | if ( ! current_user_can( 'manage_menus' ) ) { |
1465 | 1468 | wp_die( -1 ); |
| 1469 | } |
1466 | 1470 | |
1467 | 1471 | require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; |
1468 | 1472 | |
… |
… |
function wp_ajax_find_posts() { |
1700 | 1704 | function wp_ajax_widgets_order() { |
1701 | 1705 | check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); |
1702 | 1706 | |
1703 | | if ( !current_user_can('edit_theme_options') ) |
| 1707 | if ( ! current_user_can( 'manage_widgets' ) ) { |
1704 | 1708 | wp_die( -1 ); |
| 1709 | } |
1705 | 1710 | |
1706 | 1711 | unset( $_POST['savewidgets'], $_POST['action'] ); |
1707 | 1712 | |
… |
… |
function wp_ajax_save_widget() { |
1738 | 1743 | |
1739 | 1744 | check_ajax_referer( 'save-sidebar-widgets', 'savewidgets' ); |
1740 | 1745 | |
1741 | | if ( !current_user_can('edit_theme_options') || !isset($_POST['id_base']) ) |
| 1746 | if ( ! current_user_can( 'manage_widgets' ) || ! isset( $_POST['id_base'] ) ) { |
1742 | 1747 | wp_die( -1 ); |
| 1748 | } |
1743 | 1749 | |
1744 | 1750 | unset( $_POST['savewidgets'], $_POST['action'] ); |
1745 | 1751 | |
diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index 70bfa6e..ca198e7 100644
|
|
function wp_welcome_panel() { |
1306 | 1306 | <div class="welcome-panel-column welcome-panel-last"> |
1307 | 1307 | <h4><?php _e( 'More Actions' ); ?></h4> |
1308 | 1308 | <ul> |
1309 | | <?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?> |
| 1309 | <?php |
| 1310 | $show_widgets = ( current_theme_supports( 'widgets' ) && current_user_can( 'manage_widgets' ) ); |
| 1311 | $show_menus = ( current_theme_supports( 'menus' ) && current_user_can( 'manage_menus' ) ); |
| 1312 | ?> |
| 1313 | <?php if ( $show_widgets || $show_menus ) : ?> |
1310 | 1314 | <li><div class="welcome-icon welcome-widgets-menus"><?php |
1311 | | if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) { |
| 1315 | if ( $show_widgets && $show_menus ) { |
1312 | 1316 | printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ), |
1313 | 1317 | admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) ); |
1314 | | } elseif ( current_theme_supports( 'widgets' ) ) { |
| 1318 | } elseif ( $show_widgets ) { |
1315 | 1319 | echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>'; |
1316 | 1320 | } else { |
1317 | 1321 | echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>'; |
diff --git src/wp-admin/includes/menu.php src/wp-admin/includes/menu.php
index 873f737..e0ddc81 100644
|
|
unset($sub, $parent); |
93 | 93 | foreach ( $menu as $id => $data ) { |
94 | 94 | if ( empty($submenu[$data[2]]) ) |
95 | 95 | continue; |
96 | | $subs = $submenu[$data[2]]; |
97 | | $first_sub = array_shift($subs); |
| 96 | $subs = $submenu[ $data[2] ]; |
| 97 | $first_sub = array_shift( $subs ); |
98 | 98 | $old_parent = $data[2]; |
99 | 99 | $new_parent = $first_sub[2]; |
100 | 100 | /* |
… |
… |
foreach ( $menu as $id => $data ) { |
102 | 102 | * make the first submenu the new parent. |
103 | 103 | */ |
104 | 104 | if ( $new_parent != $old_parent ) { |
105 | | $_wp_real_parent_file[$old_parent] = $new_parent; |
106 | | $menu[$id][2] = $new_parent; |
| 105 | $_wp_real_parent_file[ $old_parent ] = $new_parent; |
| 106 | $menu[ $id ][1] = $first_sub[1]; // capability |
| 107 | $menu[ $id ][2] = $first_sub[2]; // location |
| 108 | if ( empty( $subs ) ) { |
| 109 | $menu[ $id ][0] = $first_sub[0]; // label |
| 110 | } |
107 | 111 | |
108 | 112 | foreach ($submenu[$old_parent] as $index => $data) { |
109 | 113 | $submenu[$new_parent][$index] = $submenu[$old_parent][$index]; |
diff --git src/wp-admin/includes/template.php src/wp-admin/includes/template.php
index 26c8a4a..88c248d 100644
|
|
final class WP_Internal_Pointers { |
2017 | 2017 | } |
2018 | 2018 | |
2019 | 2019 | public static function pointer_wp390_widgets() { |
2020 | | if ( ! current_theme_supports( 'widgets' ) ) { |
| 2020 | if ( ! current_theme_supports( 'widgets' ) || ! current_user_can( 'manage_widgets' ) ) { |
2021 | 2021 | return; |
2022 | 2022 | } |
2023 | 2023 | |
diff --git src/wp-admin/menu.php src/wp-admin/menu.php
index 89c13d9..40d1ea8 100644
|
|
$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-to |
154 | 154 | $submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', $customize_url, '', 'hide-if-no-customize' ); |
155 | 155 | |
156 | 156 | if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) { |
157 | | $submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php'); |
| 157 | $submenu['themes.php'][10] = array(__( 'Menus' ), 'manage_menus', 'nav-menus.php'); |
158 | 158 | } |
159 | 159 | |
160 | | if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) { |
| 160 | if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) && current_user_can( 'manage_custom_header' ) ) { |
161 | 161 | $customize_header_url = add_query_arg( 'autofocus[control]', 'header_image', $customize_url ); |
162 | 162 | $submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, $customize_header_url, '', 'hide-if-no-customize' ); |
163 | 163 | } |
164 | 164 | |
165 | | if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) { |
| 165 | if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') && current_user_can( 'manage_custom_background' ) ) { |
166 | 166 | $customize_background_url = add_query_arg( 'autofocus[control]', 'background_image', $customize_url ); |
167 | 167 | $submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, $customize_background_url, '', 'hide-if-no-customize' ); |
168 | 168 | } |
diff --git src/wp-admin/nav-menus.php src/wp-admin/nav-menus.php
index 5f99e72..e639b99 100644
|
|
require_once( dirname( __FILE__ ) . '/admin.php' ); |
15 | 15 | // Load all the nav menu interface functions |
16 | 16 | require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' ); |
17 | 17 | |
18 | | if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) ) |
| 18 | if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) ) { |
19 | 19 | wp_die( __( 'Your theme does not support navigation menus or widgets.' ) ); |
| 20 | } |
20 | 21 | |
21 | 22 | // Permissions Check |
22 | | if ( ! current_user_can('edit_theme_options') ) |
| 23 | if ( ! current_user_can( 'manage_menus' ) ) { |
23 | 24 | wp_die( __( 'Cheatin’ uh?' ), 403 ); |
| 25 | } |
| 26 | if ( ! current_theme_supports( 'menus' ) && ! current_user_can( 'manage_widgets' ) ) { |
| 27 | wp_die( __( 'Your theme does not support navigation menus and you do not have permission to manage widgets.' ) ); |
| 28 | } |
24 | 29 | |
25 | 30 | wp_enqueue_script( 'nav-menu' ); |
26 | 31 | |
diff --git src/wp-admin/widgets.php src/wp-admin/widgets.php
index 222251a..75aca58 100644
|
|
require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | /** WordPress Administration Widgets API */ |
13 | 13 | require_once(ABSPATH . 'wp-admin/includes/widgets.php'); |
14 | 14 | |
15 | | if ( ! current_user_can('edit_theme_options') ) |
| 15 | if ( ! current_user_can( 'manage_widgets' ) ) { |
16 | 16 | wp_die( __( 'Cheatin’ uh?' ), 403 ); |
| 17 | } |
17 | 18 | |
18 | 19 | $widgets_access = get_user_setting( 'widgets_access' ); |
19 | 20 | if ( isset($_GET['widgets-access']) ) { |
diff --git src/wp-includes/admin-bar.php src/wp-includes/admin-bar.php
index 49279a9..1dcabfb 100644
|
|
function wp_admin_bar_comments_menu( $wp_admin_bar ) { |
657 | 657 | function wp_admin_bar_appearance_menu( $wp_admin_bar ) { |
658 | 658 | $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) ); |
659 | 659 | |
660 | | if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) |
661 | | $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) ); |
662 | | |
663 | | if ( ! current_user_can( 'edit_theme_options' ) ) |
664 | | return; |
| 660 | if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) { |
| 661 | $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __( 'Themes' ), 'href' => admin_url( 'themes.php' ) ) ); |
| 662 | } |
665 | 663 | |
666 | 664 | $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
667 | 665 | $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() ); |
… |
… |
function wp_admin_bar_appearance_menu( $wp_admin_bar ) { |
678 | 676 | add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' ); |
679 | 677 | } |
680 | 678 | |
681 | | if ( current_theme_supports( 'widgets' ) ) { |
| 679 | if ( current_user_can( 'manage_widgets' ) && current_theme_supports( 'widgets' ) ) { |
682 | 680 | $wp_admin_bar->add_menu( array( |
683 | 681 | 'parent' => 'appearance', |
684 | 682 | 'id' => 'widgets', |
… |
… |
function wp_admin_bar_appearance_menu( $wp_admin_bar ) { |
702 | 700 | } |
703 | 701 | } |
704 | 702 | |
705 | | if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) |
706 | | $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) ); |
| 703 | if ( current_user_can( 'manage_menus' ) && ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) ) { |
| 704 | $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __( 'Menus' ), 'href' => admin_url( 'nav-menus.php' ) ) ); |
| 705 | } |
707 | 706 | |
708 | | if ( current_theme_supports( 'custom-background' ) ) { |
| 707 | if ( current_user_can( 'manage_custom_background' ) && current_theme_supports( 'custom-background' ) ) { |
709 | 708 | $wp_admin_bar->add_menu( array( |
710 | 709 | 'parent' => 'appearance', |
711 | 710 | 'id' => 'background', |
… |
… |
function wp_admin_bar_appearance_menu( $wp_admin_bar ) { |
729 | 728 | } |
730 | 729 | } |
731 | 730 | |
732 | | if ( current_theme_supports( 'custom-header' ) ) { |
| 731 | if ( current_user_can( 'manage_custom_header' ) && current_theme_supports( 'custom-header' ) ) { |
733 | 732 | $wp_admin_bar->add_menu( array( |
734 | 733 | 'parent' => 'appearance', |
735 | 734 | 'id' => 'header', |
diff --git src/wp-includes/capabilities.php src/wp-includes/capabilities.php
index 160c20e..0f14162 100644
|
|
function map_meta_cap( $cap, $user_id ) { |
1335 | 1335 | case 'customize' : |
1336 | 1336 | $caps[] = 'edit_theme_options'; |
1337 | 1337 | break; |
| 1338 | case 'manage_menus' : |
| 1339 | $caps[] = 'edit_theme_options'; |
| 1340 | break; |
| 1341 | case 'manage_widgets' : |
| 1342 | $caps[] = 'edit_theme_options'; |
| 1343 | break; |
| 1344 | case 'manage_custom_header' : |
| 1345 | $caps[] = 'edit_theme_options'; |
| 1346 | break; |
| 1347 | case 'manage_custom_background' : |
| 1348 | $caps[] = 'edit_theme_options'; |
| 1349 | break; |
1338 | 1350 | default: |
1339 | 1351 | // Handle meta capabilities for custom post types. |
1340 | 1352 | $post_type_meta_caps = _post_type_meta_capabilities(); |
diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
index c9dc52d..9b017b9 100644
|
|
final class WP_Customize_Manager { |
1026 | 1026 | $this->add_section( 'colors', array( |
1027 | 1027 | 'title' => __( 'Colors' ), |
1028 | 1028 | 'priority' => 40, |
| 1029 | 'capability' => '', // set to empty so that capability will be derived from contained controls (and their settings) |
1029 | 1030 | ) ); |
1030 | 1031 | |
1031 | 1032 | $this->add_setting( 'header_textcolor', array( |
1032 | 1033 | 'theme_supports' => array( 'custom-header', 'header-text' ), |
1033 | 1034 | 'default' => get_theme_support( 'custom-header', 'default-text-color' ), |
| 1035 | 'capability' => 'manage_custom_header', |
1034 | 1036 | |
1035 | 1037 | 'sanitize_callback' => array( $this, '_sanitize_header_textcolor' ), |
1036 | 1038 | 'sanitize_js_callback' => 'maybe_hash_hex_color', |
… |
… |
final class WP_Customize_Manager { |
1055 | 1057 | $this->add_setting( 'background_color', array( |
1056 | 1058 | 'default' => get_theme_support( 'custom-background', 'default-color' ), |
1057 | 1059 | 'theme_supports' => 'custom-background', |
| 1060 | 'capability' => 'manage_custom_background', |
1058 | 1061 | |
1059 | 1062 | 'sanitize_callback' => 'sanitize_hex_color_no_hash', |
1060 | 1063 | 'sanitize_js_callback' => 'maybe_hash_hex_color', |
… |
… |
final class WP_Customize_Manager { |
1072 | 1075 | 'title' => __( 'Header Image' ), |
1073 | 1076 | 'theme_supports' => 'custom-header', |
1074 | 1077 | 'priority' => 60, |
| 1078 | 'capability' => '', // set to empty so that capability will be derived from contained controls (and their settings) |
1075 | 1079 | ) ); |
1076 | 1080 | |
1077 | 1081 | $this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array( |
1078 | 1082 | 'default' => get_theme_support( 'custom-header', 'default-image' ), |
1079 | 1083 | 'theme_supports' => 'custom-header', |
| 1084 | 'capability' => 'manage_custom_header', |
1080 | 1085 | ) ) ); |
1081 | 1086 | |
1082 | 1087 | $this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array( |
1083 | 1088 | // 'default' => get_theme_support( 'custom-header', 'default-image' ), |
1084 | 1089 | 'theme_supports' => 'custom-header', |
| 1090 | 'capability' => 'manage_custom_header', |
1085 | 1091 | ) ) ); |
1086 | 1092 | |
1087 | 1093 | $this->add_control( new WP_Customize_Header_Image_Control( $this ) ); |
… |
… |
final class WP_Customize_Manager { |
1092 | 1098 | 'title' => __( 'Background Image' ), |
1093 | 1099 | 'theme_supports' => 'custom-background', |
1094 | 1100 | 'priority' => 80, |
| 1101 | 'capability' => '', // set to empty so that capability will be derived from contained controls (and their settings) |
1095 | 1102 | ) ); |
1096 | 1103 | |
1097 | 1104 | $this->add_setting( 'background_image', array( |
1098 | 1105 | 'default' => get_theme_support( 'custom-background', 'default-image' ), |
1099 | 1106 | 'theme_supports' => 'custom-background', |
| 1107 | 'capability' => 'manage_custom_background', |
1100 | 1108 | ) ); |
1101 | 1109 | |
1102 | 1110 | $this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array( |
1103 | 1111 | 'theme_supports' => 'custom-background', |
| 1112 | 'capability' => 'manage_custom_background', |
1104 | 1113 | ) ) ); |
1105 | 1114 | |
1106 | 1115 | $this->add_control( new WP_Customize_Background_Image_Control( $this ) ); |
… |
… |
final class WP_Customize_Manager { |
1108 | 1117 | $this->add_setting( 'background_repeat', array( |
1109 | 1118 | 'default' => get_theme_support( 'custom-background', 'default-repeat' ), |
1110 | 1119 | 'theme_supports' => 'custom-background', |
| 1120 | 'capability' => 'manage_custom_background', |
1111 | 1121 | ) ); |
1112 | 1122 | |
1113 | 1123 | $this->add_control( 'background_repeat', array( |
… |
… |
final class WP_Customize_Manager { |
1125 | 1135 | $this->add_setting( 'background_position_x', array( |
1126 | 1136 | 'default' => get_theme_support( 'custom-background', 'default-position-x' ), |
1127 | 1137 | 'theme_supports' => 'custom-background', |
| 1138 | 'capability' => 'manage_custom_background', |
1128 | 1139 | ) ); |
1129 | 1140 | |
1130 | 1141 | $this->add_control( 'background_position_x', array( |
1131 | 1142 | 'label' => __( 'Background Position' ), |
1132 | 1143 | 'section' => 'background_image', |
| 1144 | 'capability' => 'manage_custom_background', |
1133 | 1145 | 'type' => 'radio', |
1134 | 1146 | 'choices' => array( |
1135 | 1147 | 'left' => __('Left'), |
… |
… |
final class WP_Customize_Manager { |
1141 | 1153 | $this->add_setting( 'background_attachment', array( |
1142 | 1154 | 'default' => get_theme_support( 'custom-background', 'default-attachment' ), |
1143 | 1155 | 'theme_supports' => 'custom-background', |
| 1156 | 'capability' => 'manage_custom_background', |
1144 | 1157 | ) ); |
1145 | 1158 | |
1146 | 1159 | $this->add_control( 'background_attachment', array( |
… |
… |
final class WP_Customize_Manager { |
1171 | 1184 | 'title' => __( 'Navigation' ), |
1172 | 1185 | 'theme_supports' => 'menus', |
1173 | 1186 | 'priority' => 100, |
1174 | | 'description' => sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . "\n\n" . __('You can edit your menu content on the Menus screen in the Appearance section.'), |
| 1187 | 'description' => sprintf( _n( 'Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . "\n\n" . __( 'You can edit your menu content on the Menus screen in the Appearance section.' ), |
| 1188 | 'capability' => 'manage_menus', |
1175 | 1189 | ) ); |
1176 | 1190 | |
1177 | 1191 | if ( $menus ) { |
… |
… |
final class WP_Customize_Manager { |
1186 | 1200 | $this->add_setting( $menu_setting_id, array( |
1187 | 1201 | 'sanitize_callback' => 'absint', |
1188 | 1202 | 'theme_supports' => 'menus', |
| 1203 | 'capability' => 'manage_menus', |
1189 | 1204 | ) ); |
1190 | 1205 | |
1191 | 1206 | $this->add_control( $menu_setting_id, array( |
diff --git src/wp-includes/class-wp-customize-widgets.php src/wp-includes/class-wp-customize-widgets.php
index ad5742f..c493d2e 100644
|
|
final class WP_Customize_Widgets { |
437 | 437 | 'title' => __( 'Widgets' ), |
438 | 438 | 'description' => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ), |
439 | 439 | 'priority' => 110, |
| 440 | 'capability' => 'manage_widgets', |
440 | 441 | ) ); |
441 | 442 | |
442 | 443 | foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) { |
… |
… |
final class WP_Customize_Widgets { |
469 | 470 | 'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ), |
470 | 471 | 'panel' => 'widgets', |
471 | 472 | 'sidebar_id' => $sidebar_id, |
| 473 | 'capability' => 'manage_widgets', |
472 | 474 | ); |
473 | 475 | |
474 | 476 | /** |
… |
… |
final class WP_Customize_Widgets { |
800 | 802 | public function get_setting_args( $id, $overrides = array() ) { |
801 | 803 | $args = array( |
802 | 804 | 'type' => 'option', |
803 | | 'capability' => 'edit_theme_options', |
| 805 | 'capability' => 'manage_widgets', |
804 | 806 | 'transport' => 'refresh', |
805 | 807 | 'default' => array(), |
806 | 808 | ); |
… |
… |
final class WP_Customize_Widgets { |
1379 | 1381 | |
1380 | 1382 | check_ajax_referer( 'update-widget', 'nonce' ); |
1381 | 1383 | |
1382 | | if ( ! current_user_can( 'edit_theme_options' ) ) { |
| 1384 | if ( ! current_user_can( 'manage_widgets' ) ) { |
1383 | 1385 | wp_die( -1 ); |
1384 | 1386 | } |
1385 | 1387 | |
diff --git src/wp-includes/default-widgets.php src/wp-includes/default-widgets.php
index 180e074..e48ea0a 100644
|
|
class WP_Widget_Tag_Cloud extends WP_Widget { |
1348 | 1348 | $menus = wp_get_nav_menus(); |
1349 | 1349 | |
1350 | 1350 | // If no menus exists, direct the user to go and create some. |
1351 | | if ( !$menus ) { |
1352 | | echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>'; |
| 1351 | if ( ! $menus ) { |
| 1352 | if ( current_user_can( 'manage_menus' ) ) { |
| 1353 | echo '<p>'. sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), admin_url( 'nav-menus.php' ) ) . '</p>'; |
| 1354 | } else { |
| 1355 | echo '<p>' . __( 'No menus have been created yet, and you do not have permission to create them.' ) . '</p>'; |
| 1356 | } |
1353 | 1357 | return; |
1354 | 1358 | } |
1355 | 1359 | ?> |
diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 072d12c..bac5c3a 100644
|
|
function wp_widgets_add_menu() { |
3255 | 3255 | if ( ! current_theme_supports( 'widgets' ) ) |
3256 | 3256 | return; |
3257 | 3257 | |
3258 | | $submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' ); |
| 3258 | $submenu['themes.php'][7] = array( __( 'Widgets' ), 'manage_widgets', 'widgets.php' ); |
3259 | 3259 | ksort( $submenu['themes.php'], SORT_NUMERIC ); |
3260 | 3260 | } |
3261 | 3261 | |