WordPress.org

Make WordPress Core

Ticket #44176: 44176.2.diff

File 44176.2.diff, 2.8 KB (added by xkon, 22 months ago)
  • src/wp-admin/includes/schema.php

    diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php
    index a2e8216457..b0d2a4ec6e 100644
    a b function populate_roles() { 
    695695        populate_roles_270();
    696696        populate_roles_280();
    697697        populate_roles_300();
     698        populate_roles_540();
    698699}
    699700
    700701/**
    function populate_roles_300() { 
    924925        }
    925926}
    926927
     928/**
     929 * Create and modify WordPress roles for WordPress 5.4.
     930 *
     931 * @since 5.4.0
     932 */
     933function 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
    927944if ( ! function_exists( 'install_network' ) ) :
    928945        /**
    929946         * Install Network.
  • src/wp-admin/menu.php

    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 ) 
    288288        $submenu['tools.php'][50] = array( __( 'Network Setup' ), 'setup_network', 'network.php' );
    289289}
    290290
    291 $menu[80]                               = array( __( 'Settings' ), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
     291if ( 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
    292297        $submenu['options-general.php'][10] = array( _x( 'General', 'settings screen' ), 'manage_options', 'options-general.php' );
    293298        $submenu['options-general.php'][15] = array( __( 'Writing' ), 'manage_options', 'options-writing.php' );
    294299        $submenu['options-general.php'][20] = array( __( 'Reading' ), 'manage_options', 'options-reading.php' );
  • src/wp-includes/capabilities.php

    diff --git a/src/wp-includes/capabilities.php b/src/wp-includes/capabilities.php
    index 0c40c7e384..afd089618f 100644
    a b function map_meta_cap( $cap, $user_id, ...$args ) { 
    573573                                $caps[] = 'update_core';
    574574                        }
    575575                        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;
    581576                default:
    582577                        // Handle meta capabilities for custom post types.
    583578                        global $post_type_meta_caps;