Make WordPress Core

Ticket #43919: 43919.2.diff

File 43919.2.diff, 2.2 KB (added by allendav, 6 years ago)

Make the disabling of export and erasure filterable

  • src/wp-admin/includes/user.php

     
    789789                wp_die( esc_html__( 'Sorry, you are not allowed to manage privacy on this site.' ) );
    790790        }
    791791
     792        if ( ! apply_filters( 'wp_privacy_personal_data_export_enable', ! is_multisite() ) ) {
     793                wp_die( esc_html__( 'Sorry, personal data export is disabled.' ) );
     794        }
     795
    792796        _wp_personal_data_handle_actions();
    793797        _wp_personal_data_cleanup_requests();
    794798
     
    854858                wp_die( esc_html__( 'Sorry, you are not allowed to manage privacy on this site.' ) );
    855859        }
    856860
     861        if ( ! apply_filters( 'wp_privacy_personal_data_erasure_enable', ! is_multisite() ) ) {
     862                wp_die( esc_html__( 'Sorry, personal data erasure is disabled.' ) );
     863        }
     864
    857865        _wp_personal_data_handle_actions();
    858866        _wp_personal_data_cleanup_requests();
    859867
     
    917925 * @access private
    918926 */
    919927function _wp_privacy_hook_requests_page() {
    920         add_submenu_page( 'tools.php', __( 'Export Personal Data' ), __( 'Export Personal Data' ), 'manage_options', 'export_personal_data', '_wp_personal_data_export_page' );
    921         add_submenu_page( 'tools.php', __( 'Remove Personal Data' ), __( 'Remove Personal Data' ), 'manage_options', 'remove_personal_data', '_wp_personal_data_removal_page' );
     928        if ( apply_filters( 'wp_privacy_personal_data_export_enable', ! is_multisite() ) ) {
     929                add_submenu_page( 'tools.php', __( 'Export Personal Data' ), __( 'Export Personal Data' ), 'manage_options', 'export_personal_data', '_wp_personal_data_export_page' );
     930        }
     931
     932        if ( apply_filters( 'wp_privacy_personal_data_erasure_enable', ! is_multisite() ) ) {
     933                add_submenu_page( 'tools.php', __( 'Remove Personal Data' ), __( 'Remove Personal Data' ), 'manage_options', 'remove_personal_data', '_wp_personal_data_removal_page' );
     934        }
    922935}
    923936
    924937// TODO: move the following classes in new files.
     
    10091022                }
    10101023
    10111024                $query = "
    1012                         SELECT post_status, COUNT( * ) AS num_posts 
    1013                         FROM {$wpdb->posts} 
     1025                        SELECT post_status, COUNT( * ) AS num_posts
     1026                        FROM {$wpdb->posts}
    10141027                        WHERE post_type = %s
    10151028                        AND post_name = %s
    10161029                        GROUP BY post_status";