Making WordPress.org

Changeset 7193


Ignore:
Timestamp:
05/11/2018 08:31:59 PM (8 years ago)
Author:
coreymckrill
Message:

WordCamp: Temporarily disable the privacy tools in 4.9.6

At this point the privacy tools in Core are only designed for single site
installations. Using them on a large multisite network like WordCamp.org could
have negative unintended consequences, especially since the user table is
shared across all of the sites. Once we have a system in place for handling
privacy requests on a network-wide basis, we can re-enable the tools.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/privacy.php

    r7160 r7193  
    66
    77add_filter( 'privacy_policy_url', __NAMESPACE__ . '\set_privacy_policy_url', 10 );
     8add_filter( 'map_meta_cap', __NAMESPACE__ . '\disable_496_privacy_tools', 10, 4 );
    89
    910/**
     
    1718    return 'https://wordpress.org/about/privacy/';
    1819}
     20
     21/**
     22 * Disable the privacy tools added in WordPress 4.9.6.
     23 *
     24 * Note that this is temporary until we have a system in place for handling privacy-related requests
     25 * on a network-wide basis.
     26 *
     27 * @param array  $required_capabilities The primitive capabilities that are required to perform the requested meta capability.
     28 * @param string $requested_capability  The requested meta capability
     29 * @param int    $user_id               The user ID.
     30 * @param array  $args                  Adds the context to the cap. Typically the object ID.
     31 *
     32 * @return array The primitive capabilities that are required to perform the requested meta capability.
     33 */
     34function disable_496_privacy_tools( $required_capabilities, $requested_capability, $user_id, $args ) {
     35    $privacy_capabilities = array( 'manage_privacy_options', 'erase_others_personal_data', 'export_others_personal_data' );
     36
     37    if ( in_array( $requested_capability, $privacy_capabilities ) ) {
     38        $required_capabilities[] = 'do_not_allow';
     39    }
     40
     41    return $required_capabilities;
     42}
Note: See TracChangeset for help on using the changeset viewer.