Skip to:
Content

BuddyPress.org

Ticket #8013: 8013.2.patch

File 8013.2.patch, 13.6 KB (added by imath, 3 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..6a9cc46b8 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_bp_friendly_name` param to exporters.
    821822 *
    822823 * @param array $exporters  An array of personal data exporters.
    823824 * @return array An array of personal data exporters.
    824825 */
    825826function bp_activity_register_personal_data_exporter( $exporters ) {
    826827        $exporters['buddypress-activity'] = array(
    827                 'exporter_friendly_name' => __( 'BuddyPress Activity Data', 'buddypress' ),
    828                 'callback'               => 'bp_activity_personal_data_exporter',
     828                'exporter_friendly_name'    => __( 'BuddyPress Activity Data', 'buddypress' ),
     829                'callback'                  => 'bp_activity_personal_data_exporter',
     830                'exporter_bp_friendly_name' => _x( 'Activity Data', 'BuddyPress Activity data exporter friendly 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..24ecea0ea 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_bp_friendly_name` param to exporters.
    5556 *
    5657 * @param array $exporters  An array of personal data exporters.
    5758 * @return array An array of personal data exporters.
    5859 */
    5960function bp_friends_register_personal_data_exporters( $exporters ) {
    6061        $exporters['buddypress-friends'] = array(
    61                 'exporter_friendly_name' => __( 'BuddyPress Friends', 'buddypress' ),
    62                 'callback'               => 'bp_friends_personal_data_exporter',
     62                'exporter_friendly_name'    => __( 'BuddyPress Friends', 'buddypress' ),
     63                'callback'                  => 'bp_friends_personal_data_exporter',
     64                'exporter_bp_friendly_name' => _x( 'Friends', 'BuddyPress Friends data exporter friendly name', 'buddypress' ),
    6365        );
    6466
    6567        $exporters['buddypress-friends-pending-sent-requests'] = array(
    66                 'exporter_friendly_name' => __( 'BuddyPress Friend Requests (Sent)', 'buddypress' ),
    67                 'callback'               => 'bp_friends_pending_sent_requests_personal_data_exporter',
     68                'exporter_friendly_name'    => __( 'BuddyPress Friend Requests (Sent)', 'buddypress' ),
     69                'callback'                  => 'bp_friends_pending_sent_requests_personal_data_exporter',
     70                'exporter_bp_friendly_name' => _x( 'Friend Requests (Sent)', 'BuddyPress Friend Requests data exporter friendly name', 'buddypress' ),
    6871        );
    6972
    7073        $exporters['buddypress-friends-pending-received-requests'] = array(
    71                 'exporter_friendly_name' => __( 'BuddyPress Friend Requests (Received)', 'buddypress' ),
    72                 'callback'               => 'bp_friends_pending_received_requests_personal_data_exporter',
     74                'exporter_friendly_name'    => __( 'BuddyPress Friend Requests (Received)', 'buddypress' ),
     75                'callback'                  => 'bp_friends_pending_received_requests_personal_data_exporter',
     76                'exporter_bp_friendly_name' => _x( 'Friend Requests (Received)', 'BuddyPress Friend Requests data exporter friendly name', 'buddypress' ),
    7377        );
    7478
    7579        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..fe4310d1a 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_bp_friendly_name` param to exporters.
    373374 *
    374375 * @param array $exporters  An array of personal data exporters.
    375376 * @return array An array of personal data exporters.
    376377 */
    377378function bp_groups_register_personal_data_exporters( $exporters ) {
    378379        $exporters['buddypress-groups-memberships'] = array(
    379                 'exporter_friendly_name' => __( 'BuddyPress Group Memberships', 'buddypress' ),
    380                 'callback'               => 'bp_groups_memberships_personal_data_exporter',
     380                'exporter_friendly_name'    => __( 'BuddyPress Group Memberships', 'buddypress' ),
     381                'callback'                  => 'bp_groups_memberships_personal_data_exporter',
     382                'exporter_bp_friendly_name' => _x( 'Group Memberships', 'BuddyPress Group Memberships data exporter friendly name', 'buddypress' ),
    381383        );
    382384
    383385        $exporters['buddypress-groups-pending-requests'] = array(
    384                 'exporter_friendly_name' => __( 'BuddyPress Pending Group Membership Requests', 'buddypress' ),
    385                 'callback'               => 'bp_groups_pending_requests_personal_data_exporter',
     386                'exporter_friendly_name'    => __( 'BuddyPress Pending Group Membership Requests', 'buddypress' ),
     387                'callback'                  => 'bp_groups_pending_requests_personal_data_exporter',
     388                'exporter_bp_friendly_name' => _x( 'Pending Group Membership Requests', 'BuddyPress Pending Group Membership Requests data exporter friendly name', 'buddypress' ),
    386389        );
    387390
    388391        $exporters['buddypress-groups-pending-received-invitations'] = array(
    389                 'exporter_friendly_name' => __( 'BuddyPress Pending Group Invitations (Received)', 'buddypress' ),
    390                 'callback'               => 'bp_groups_pending_received_invitations_personal_data_exporter',
     392                'exporter_friendly_name'    => __( 'BuddyPress Pending Group Invitations (Received)', 'buddypress' ),
     393                'callback'                  => 'bp_groups_pending_received_invitations_personal_data_exporter',
     394                'exporter_bp_friendly_name' => _x( 'Pending Group Invitations (Received)', 'BuddyPress Pending Group Invitations data exporter friendly name', 'buddypress' ),
    391395        );
    392396
    393397        $exporters['buddypress-groups-pending-sent-invitations'] = array(
    394                 'exporter_friendly_name' => __( 'BuddyPress Pending Group Invitations (Sent)', 'buddypress' ),
    395                 'callback'               => 'bp_groups_pending_sent_invitations_personal_data_exporter',
     398                'exporter_friendly_name'    => __( 'BuddyPress Pending Group Invitations (Sent)', 'buddypress' ),
     399                'callback'                  => 'bp_groups_pending_sent_invitations_personal_data_exporter',
     400                'exporter_bp_friendly_name' => _x( 'Pending Group Invitations (Sent)', 'BuddyPress Pending Group Invitations data exporter friendly 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..fad054023 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_bp_friendly_name` param to exporters.
    137138 *
    138139 * @param array $exporters  An array of personal data exporters.
    139140 * @return array An array of personal data exporters.
    140141 */
    141142function bp_messages_register_personal_data_exporter( $exporters ) {
    142143        $exporters['buddypress-messages'] = array(
    143                 'exporter_friendly_name' => __( 'BuddyPress Messages', 'buddypress' ),
    144                 'callback'               => 'bp_messages_personal_data_exporter',
     144                'exporter_friendly_name'    => __( 'BuddyPress Messages', 'buddypress' ),
     145                'callback'                  => 'bp_messages_personal_data_exporter',
     146                'exporter_bp_friendly_name' => _x( 'Private Messages', 'BuddyPress Messages data exporter friendly 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..e9fee111b 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_bp_friendly_name` param to exporters.
    1718 *
    1819 * @param array $exporters  An array of personal data exporters.
    1920 * @return array An array of personal data exporters.
    2021 */
    2122function bp_register_notifications_personal_data_exporter( $exporters ) {
    2223        $exporters['buddypress-notifications'] = array(
    23                 'exporter_friendly_name' => __( 'BuddyPress Notifications Data', 'buddypress' ),
    24                 'callback'               => 'bp_notifications_personal_data_exporter',
     24                'exporter_friendly_name'    => __( 'BuddyPress Notifications Data', 'buddypress' ),
     25                'callback'                  => 'bp_notifications_personal_data_exporter',
     26                'exporter_bp_friendly_name' => _x( 'Notifications Data', 'BuddyPress Notifications data exporter friendly 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..2fa1cd845 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_bp_friendly_name` param to exporters.
    1617 *
    1718 * @param array $exporters  An array of personal data exporters.
    1819 * @return array An array of personal data exporters.
    1920 */
    2021function bp_settings_register_personal_data_exporter( $exporters ) {
    2122        $exporters['buddypress-settings'] = array(
    22                 'exporter_friendly_name' => __( 'BuddyPress Settings Data', 'buddypress' ),
    23                 'callback'               => 'bp_settings_personal_data_exporter',
     23                'exporter_friendly_name'    => __( 'BuddyPress Settings Data', 'buddypress' ),
     24                'callback'                  => 'bp_settings_personal_data_exporter',
     25                'exporter_bp_friendly_name' => _x( 'Personal settings', 'BuddyPress Settings Data data exporter friendly 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..b2d9c843c 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 BP/custom friendly 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_friendly_names = apply_filters( 'bp_settings_data_custom_friendly_names', array(
     326                'wordpress-comments' => _x( 'Comments', 'WP Comments data exporter friendly name', 'buddypress' ),
     327                'wordpress-media'    => _x( 'Media', 'WP Media data exporter friendly name', 'buddypress' ),
     328                'wordpress-user'     => _x( 'Personal information', 'WP Media data exporter friendly name', 'buddypress' ),
     329        ) );
    326330
    327331?>
    328332        <ul>
    329333        <?php foreach ( $exporters as $exporter => $data ) :
     334                // Use the exporter friendly name by default.
     335                $friendly_name = $data['exporter_friendly_name'];
     336
     337                /**
     338                 * Use the exporter friendly name if directly available
     339                 * into the exporters array.
     340                 */
     341                if ( isset( $data['exporter_bp_friendly_name'] ) ) {
     342                        $friendly_name = $data['exporter_bp_friendly_name'];
     343
     344                // Look for a potential match into the custom friendly names.
     345                } elseif ( isset( $custom_friendly_names[ $exporter ] ) ) {
     346                        $friendly_name = $custom_friendly_names[ $exporter ];
     347                }
     348
    330349                /**
    331                  * Filters the data exporter name for display on the "Settings > Data" page.
     350                 * Filters the data exporter friendly 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 `$friendly_name` one.
    334354                 *
    335                  * @param string $name    Data exporter friendly name.
    336                  * @param string $exporter Internal exporter name.
     355                 * @param string $friendly_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( $friendly_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..64282e4b0 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_bp_friendly_name` param to exporters.
    669670 *
    670671 * @param array $exporters  An array of personal data exporters.
    671672 * @return array An array of personal data exporters.
    672673 */
    673674function bp_xprofile_register_personal_data_exporter( $exporters ) {
    674675        $exporters['buddypress-xprofile'] = array(
    675                 'exporter_friendly_name' => __( 'BuddyPress Extended Profile Data', 'buddypress' ),
    676                 'callback'               => 'bp_xprofile_personal_data_exporter',
     676                'exporter_friendly_name'    => __( 'BuddyPress Extended Profile Data', 'buddypress' ),
     677                'callback'                  => 'bp_xprofile_personal_data_exporter',
     678                'exporter_bp_friendly_name' => _x( 'Extended Profile information', 'BuddyPress Extended Profile data exporter friendly name', 'buddypress' ),
    677679        );
    678680
    679681        return $exporters;