diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
index a2e8216457..5a25babc41 100644
|
a
|
b
|
function populate_roles() {
|
| 695 | 695 | populate_roles_270(); |
| 696 | 696 | populate_roles_280(); |
| 697 | 697 | populate_roles_300(); |
| | 698 | populate_roles_540(); |
| 698 | 699 | } |
| 699 | 700 | |
| 700 | 701 | /** |
| … |
… |
function populate_roles_300() {
|
| 924 | 925 | } |
| 925 | 926 | } |
| 926 | 927 | |
| | 928 | /** |
| | 929 | * Create and modify WordPress roles for WordPress 5.4. |
| | 930 | * |
| | 931 | * @since 5.4.0 |
| | 932 | */ |
| | 933 | function populate_roles_540() { |
| | 934 | // Add the privacy caps to the Administrators. |
| | 935 | $role = get_role( 'administrator' ); |
| | 936 | |
| | 937 | if ( ! empty( $role ) ) { |
| | 938 | $role->add_cap( 'export_others_personal_data' ); |
| | 939 | $role->add_cap( 'erase_others_personal_data' ); |
| | 940 | $role->add_cap( 'manage_privacy_options' ); |
| | 941 | } |
| | 942 | |
| | 943 | $role = get_role( 'editor' ); |
| | 944 | if ( ! empty( $role ) ) { |
| | 945 | $role->add_cap( 'manage_privacy_options' ); |
| | 946 | } |
| | 947 | } |
| | 948 | |
| 927 | 949 | if ( ! function_exists( 'install_network' ) ) : |
| 928 | 950 | /** |
| 929 | 951 | * Install Network. |
diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php
index 505b0aad17..16aa8f4d02 100644
|
a
|
b
|
function upgrade_all() {
|
| 833 | 833 | upgrade_530(); |
| 834 | 834 | } |
| 835 | 835 | |
| | 836 | // @todo update the db_version in this check when the proper one is known. |
| | 837 | if ( $wp_current_db_version < 45806 ) { |
| | 838 | upgrade_540(); |
| | 839 | } |
| | 840 | |
| 836 | 841 | maybe_disable_link_manager(); |
| 837 | 842 | |
| 838 | 843 | maybe_disable_automattic_widgets(); |
| … |
… |
function upgrade_530() {
|
| 2148 | 2153 | } |
| 2149 | 2154 | } |
| 2150 | 2155 | |
| | 2156 | /** |
| | 2157 | * Executes changes made in WordPress 5.4.0. |
| | 2158 | * |
| | 2159 | * @ignore |
| | 2160 | * @since 5.4.0 |
| | 2161 | */ |
| | 2162 | function upgrade_540() { |
| | 2163 | global $wp_current_db_version; |
| | 2164 | |
| | 2165 | // @todo update the db_version in this check when the proper one is known. |
| | 2166 | if ( $wp_current_db_version < 45806 ) { |
| | 2167 | populate_roles_540(); |
| | 2168 | } |
| | 2169 | } |
| | 2170 | |
| 2151 | 2171 | /** |
| 2152 | 2172 | * Executes network-level upgrade routines. |
| 2153 | 2173 | * |
diff --git a/src/wp-admin/menu.php b/src/wp-admin/menu.php
index 7aec19663d..b78d4f5bde 100644
|
a
|
b
|
if ( ! is_multisite() && defined( 'WP_ALLOW_MULTISITE' ) && WP_ALLOW_MULTISITE )
|
| 288 | 288 | $submenu['tools.php'][50] = array( __( 'Network Setup' ), 'setup_network', 'network.php' ); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | | $menu[80] = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); |
| | 291 | if ( current_user_can( 'manage_options' ) ) { |
| | 292 | $menu[80] = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); |
| | 293 | } elseif ( current_user_can( 'manage_privacy_options' ) && ! current_user_can( 'manage_options' ) ) { |
| | 294 | $menu[80] = array( __( 'Settings' ), 'manage_privacy_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' ); |
| | 295 | } |
| | 296 | |
| 292 | 297 | $submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' ); |
| 293 | 298 | $submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' ); |
| 294 | 299 | $submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' ); |
diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
index 0c40c7e384..fb3de11a06 100644
|
a
|
b
|
function map_meta_cap( $cap, $user_id, ...$args ) {
|
| 132 | 132 | * so deleting it should require that too. |
| 133 | 133 | */ |
| 134 | 134 | if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { |
| 135 | | $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); |
| | 135 | $caps[] = 'manage_privacy_options'; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | break; |
| … |
… |
function map_meta_cap( $cap, $user_id, ...$args ) {
|
| 203 | 203 | * so editing it should require that too. |
| 204 | 204 | */ |
| 205 | 205 | if ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post->ID ) { |
| 206 | | $caps = array_merge( $caps, map_meta_cap( 'manage_privacy_options', $user_id ) ); |
| | 206 | $caps[] = 'manage_privacy_options'; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | break; |
| … |
… |
function map_meta_cap( $cap, $user_id, ...$args ) {
|
| 573 | 573 | $caps[] = 'update_core'; |
| 574 | 574 | } |
| 575 | 575 | break; |
| 576 | | case 'export_others_personal_data': |
| 577 | | case 'erase_others_personal_data': |
| 578 | | case 'manage_privacy_options': |
| 579 | | $caps[] = is_multisite() ? 'manage_network' : 'manage_options'; |
| 580 | | break; |
| 581 | 576 | default: |
| 582 | 577 | // Handle meta capabilities for custom post types. |
| 583 | 578 | global $post_type_meta_caps; |