WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/11/2020 06:34:08 PM (5 months ago)
Author:
SergeyBiryukov
Message:

Privacy: Un-map privacy capabilities to make them available to be assigned for custom roles:

  • erase_others_personal_data
  • export_others_personal_data
  • manage_privacy_options

Previously mapped to manage_options or manage_network (on Multisite), these are now added to the Administrator role separately.

Additionally, manage_privacy_options is added to the Editor role.

Props garrett-eclipse, xkon, pbiron, desrosj, johnbillion, flixos90, juliobox, lakenh, Ov3rfly, ianatkins.
Fixes #44176.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r47122 r47269  
    696696    populate_roles_280();
    697697    populate_roles_300();
     698    populate_roles_540();
    698699}
    699700
     
    924925}
    925926
     927/**
     928 * Create and modify WordPress roles for WordPress 5.4.0.
     929 *
     930 * @since 5.4.0
     931 */
     932function populate_roles_540() {
     933    // Add the privacy caps to the Administrators.
     934    $role = get_role( 'administrator' );
     935
     936    if ( ! empty( $role ) ) {
     937        $role->add_cap( 'export_others_personal_data' );
     938        $role->add_cap( 'erase_others_personal_data' );
     939        $role->add_cap( 'manage_privacy_options' );
     940    }
     941
     942    $role = get_role( 'editor' );
     943    if ( ! empty( $role ) ) {
     944        $role->add_cap( 'manage_privacy_options' );
     945    }
     946}
     947
    926948if ( ! function_exists( 'install_network' ) ) :
    927949    /**
Note: See TracChangeset for help on using the changeset viewer.