Skip to:
Content

BuddyPress.org

Ticket #8013: 8013.patch

File 8013.patch, 10.9 KB (added by imath, 4 months ago)
  • src/bp-activity/bp-activity-filters.php

    diff --git src/bp-activity/bp-activity-filters.php src/bp-activity/bp-activity-filters.php
    index 3cacd64f6..c36b73df4 100644
    add_filter( 'bp_activity_set_mentions_scope_args', 'bp_activity_filter_mentions_ 
    818818 * Registers Activity personal data exporter.
    819819 *
    820820 * @since 4.0.0
     821 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    821822 *
    822823 * @param array $exporters  An array of personal data exporters.
    823824 * @return array An array of personal data exporters.
    function bp_activity_register_personal_data_exporter( $exporters ) { 
    826827        $exporters['buddypress-activity'] = array(
    827828                'exporter_friendly_name' => __( 'BuddyPress Activity Data', 'buddypress' ),
    828829                'callback'               => 'bp_activity_personal_data_exporter',
     830                'exporter_frontend_name' => _x( 'Activity Data', 'BuddyPress Activity data exporter frontend name', 'buddypress' ),
    829831        );
    830832
    831833        return $exporters;
  • src/bp-friends/bp-friends-filters.php

    diff --git src/bp-friends/bp-friends-filters.php src/bp-friends/bp-friends-filters.php
    index 9cdcb1b95..acf41b7c1 100644
    add_filter( 'bp_user_query_populate_extras', 'bp_friends_filter_user_query_popul 
    5252 * Registers Friends personal data exporter.
    5353 *
    5454 * @since 4.0.0
     55 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    5556 *
    5657 * @param array $exporters  An array of personal data exporters.
    5758 * @return array An array of personal data exporters.
    function bp_friends_register_personal_data_exporters( $exporters ) { 
    7071        $exporters['buddypress-friends-pending-received-requests'] = array(
    7172                'exporter_friendly_name' => __( 'BuddyPress Friend Requests (Received)', 'buddypress' ),
    7273                'callback'               => 'bp_friends_pending_received_requests_personal_data_exporter',
     74                'exporter_frontend_name' => _x( 'Friend Requests (Received)', 'BuddyPress Friend Requests data exporter frontend name', 'buddypress' ),
    7375        );
    7476
    7577        return $exporters;
  • src/bp-groups/bp-groups-filters.php

    diff --git src/bp-groups/bp-groups-filters.php src/bp-groups/bp-groups-filters.php
    index 5214c336a..ce219084f 100644
    add_filter( 'bp_user_can', 'bp_groups_user_can_filter', 10, 5 ); 
    370370 * Registers Groups personal data exporters.
    371371 *
    372372 * @since 4.0.0
     373 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    373374 *
    374375 * @param array $exporters  An array of personal data exporters.
    375376 * @return array An array of personal data exporters.
    function bp_groups_register_personal_data_exporters( $exporters ) { 
    378379        $exporters['buddypress-groups-memberships'] = array(
    379380                'exporter_friendly_name' => __( 'BuddyPress Group Memberships', 'buddypress' ),
    380381                'callback'               => 'bp_groups_memberships_personal_data_exporter',
     382                'exporter_frontend_name' => _x( 'Group Memberships', 'BuddyPress Group Memberships data exporter frontend name', 'buddypress' ),
    381383        );
    382384
    383385        $exporters['buddypress-groups-pending-requests'] = array(
    384386                'exporter_friendly_name' => __( 'BuddyPress Pending Group Membership Requests', 'buddypress' ),
    385387                'callback'               => 'bp_groups_pending_requests_personal_data_exporter',
     388                'exporter_frontend_name' => _x( 'Pending Group Membership Requests', 'BuddyPress Pending Group Membership Requests data exporter frontend name', 'buddypress' ),
    386389        );
    387390
    388391        $exporters['buddypress-groups-pending-received-invitations'] = array(
    389392                'exporter_friendly_name' => __( 'BuddyPress Pending Group Invitations (Received)', 'buddypress' ),
    390393                'callback'               => 'bp_groups_pending_received_invitations_personal_data_exporter',
     394                'exporter_frontend_name' => _x( 'Pending Group Invitations (Received)', 'BuddyPress Pending Group Invitations data exporter frontend name', 'buddypress' ),
    391395        );
    392396
    393397        $exporters['buddypress-groups-pending-sent-invitations'] = array(
    394398                'exporter_friendly_name' => __( 'BuddyPress Pending Group Invitations (Sent)', 'buddypress' ),
    395399                'callback'               => 'bp_groups_pending_sent_invitations_personal_data_exporter',
     400                'exporter_frontend_name' => _x( 'Pending Group Invitations (Sent)', 'BuddyPress Pending Group Invitations data exporter frontend name', 'buddypress' ),
    396401        );
    397402
    398403        return $exporters;
  • src/bp-messages/bp-messages-filters.php

    diff --git src/bp-messages/bp-messages-filters.php src/bp-messages/bp-messages-filters.php
    index bc501df7b..ab5f36dd3 100644
    function bp_messages_filter_kses( $content ) { 
    134134 * Register Messages personal data exporter.
    135135 *
    136136 * @since 4.0.0
     137 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    137138 *
    138139 * @param array $exporters  An array of personal data exporters.
    139140 * @return array An array of personal data exporters.
    function bp_messages_register_personal_data_exporter( $exporters ) { 
    142143        $exporters['buddypress-messages'] = array(
    143144                'exporter_friendly_name' => __( 'BuddyPress Messages', 'buddypress' ),
    144145                'callback'               => 'bp_messages_personal_data_exporter',
     146                'exporter_frontend_name' => _x( 'Private Messages', 'BuddyPress Messages data exporter frontend name', 'buddypress' ),
    145147        );
    146148
    147149        return $exporters;
  • src/bp-notifications/bp-notifications-filters.php

    diff --git src/bp-notifications/bp-notifications-filters.php src/bp-notifications/bp-notifications-filters.php
    index 1191826f8..0efbcc5e6 100644
    add_filter( 'wp_privacy_personal_data_exporters', 'bp_register_notifications_per 
    1414 * Register Notifications personal data exporter.
    1515 *
    1616 * @since 4.0.0
     17 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    1718 *
    1819 * @param array $exporters  An array of personal data exporters.
    1920 * @return array An array of personal data exporters.
    function bp_register_notifications_personal_data_exporter( $exporters ) { 
    2223        $exporters['buddypress-notifications'] = array(
    2324                'exporter_friendly_name' => __( 'BuddyPress Notifications Data', 'buddypress' ),
    2425                'callback'               => 'bp_notifications_personal_data_exporter',
     26                'exporter_frontend_name' => _x( 'Notifications Data', 'BuddyPress Notifications data exporter frontend name', 'buddypress' ),
    2527        );
    2628
    2729        return $exporters;
  • src/bp-settings/bp-settings-filters.php

    diff --git src/bp-settings/bp-settings-filters.php src/bp-settings/bp-settings-filters.php
    index 2c9d1e573..219f127a9 100644
    add_filter( 'wp_privacy_personal_data_exporters', 'bp_settings_register_personal 
    1313 * Registers Settings personal data exporter.
    1414 *
    1515 * @since 4.0.0
     16 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    1617 *
    1718 * @param array $exporters  An array of personal data exporters.
    1819 * @return array An array of personal data exporters.
    function bp_settings_register_personal_data_exporter( $exporters ) { 
    2122        $exporters['buddypress-settings'] = array(
    2223                'exporter_friendly_name' => __( 'BuddyPress Settings Data', 'buddypress' ),
    2324                'callback'               => 'bp_settings_personal_data_exporter',
     25                'exporter_frontend_name' => _x( 'Personal settings', 'BuddyPress Settings Data data exporter frontend name', 'buddypress' ),
    2426        );
    2527
    2628        return $exporters;
  • src/bp-settings/bp-settings-functions.php

    diff --git src/bp-settings/bp-settings-functions.php src/bp-settings/bp-settings-functions.php
    index bbfb320f8..d737722cc 100644
    function bp_settings_personal_data_export_exists( WP_User_Request $request ) { 
    316316 * Piggybacks off of the 'wp_privacy_personal_data_exporters' filter and the
    317317 * 'exporter_friendly_name' key, which is meant for the admin area.
    318318 *
    319  * @todo We should look for a custom key like 'exporter_frontend_name' if available.
    320  *
    321319 * @since 4.0.0
     320 * @since 5.0.0 Looks for a potential exporter's frontend name.
    322321 */
    323322function bp_settings_data_exporter_items() {
    324323        /** This filter is documented in /wp-admin/includes/ajax-actions.php */
    325         $exporters = apply_filters( 'wp_privacy_personal_data_exporters', array() );
     324        $exporters             = apply_filters( 'wp_privacy_personal_data_exporters', array() );
     325        $custom_frontend_names = apply_filters( 'bp_settings_data_custom_frontend_names', array(
     326                'wordpress-comments' => _x( 'Comments', 'WP Comments data exporter frontend name', 'buddypress' ),
     327                'wordpress-media'    => _x( 'Media', 'WP Media data exporter frontend name', 'buddypress' ),
     328                'wordpress-user'     => _x( 'Personal information', 'WP Media data exporter frontend name', 'buddypress' ),
     329        ) );
    326330
    327331?>
    328332        <ul>
    329333        <?php foreach ( $exporters as $exporter => $data ) :
     334                // Use the exporter friendly name by default.
     335                $frontend_name = $data['exporter_friendly_name'];
     336
     337                /**
     338                 * Use the exporter frontend name if directly available
     339                 * into the exporters array.
     340                 */
     341                if ( isset( $data['exporter_frontend_name'] ) ) {
     342                        $frontend_name = $data['exporter_frontend_name'];
     343
     344                // Look for a potential match into the custom frontend names.
     345                } elseif ( isset( $custom_frontend_names[ $exporter ] ) ) {
     346                        $frontend_name = $custom_frontend_names[ $exporter ];
     347                }
     348
    330349                /**
    331                  * Filters the data exporter name for display on the "Settings > Data" page.
     350                 * Filters the data exporter frontend name for display on the "Settings > Data" page.
    332351                 *
    333352                 * @since 4.0.0
     353                 * @since 5.0.0 replaces the `$name` parameter with the `$frontend_name` one.
    334354                 *
    335                  * @param string $name    Data exporter friendly name.
    336                  * @param string $exporter Internal exporter name.
     355                 * @param string $frontend_name Data exporter friendly name.
     356                 * @param string $exporter      Internal exporter name.
    337357                 */
    338                 $item = apply_filters( 'bp_settings_data_exporter_name', esc_html( $data['exporter_friendly_name'] ), $exporter );
     358                $item = apply_filters( 'bp_settings_data_exporter_name', esc_html( $frontend_name ), $exporter );
    339359        ?>
    340360
    341361                <li><?php echo $item; ?></li>
  • src/bp-xprofile/bp-xprofile-filters.php

    diff --git src/bp-xprofile/bp-xprofile-filters.php src/bp-xprofile/bp-xprofile-filters.php
    index 5bd64c19e..7fbb15ac4 100644
    function bp_xprofile_filter_meta_query( $q ) { 
    666666 * Register XProfile personal data exporter.
    667667 *
    668668 * @since 4.0.0
     669 * @since 5.0.0 adds an `exporter_frontend_name` param to exporters.
    669670 *
    670671 * @param array $exporters  An array of personal data exporters.
    671672 * @return array An array of personal data exporters.
    function bp_xprofile_register_personal_data_exporter( $exporters ) { 
    674675        $exporters['buddypress-xprofile'] = array(
    675676                'exporter_friendly_name' => __( 'BuddyPress Extended Profile Data', 'buddypress' ),
    676677                'callback'               => 'bp_xprofile_personal_data_exporter',
     678                'exporter_frontend_name' => _x( 'Extended Profile information', 'BuddyPress Extended Profile data exporter frontend name', 'buddypress' ),
    677679        );
    678680
    679681        return $exporters;