Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/08/2023 09:42:19 AM (19 months ago)
Author:
imath
Message:

Make sure Export Data page shows right info on successful export

Once a user data file has been generated by the admin in reply to an export request, the corresponding front-end user's Settings Export Data page needs to show the link to download the generated file.

Props r-a-y

Closes https://github.com/buddypress/buddypress/pull/97
See #8858 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-settings/bp-settings-functions.php

    r13450 r13473  
    264264 */
    265265function bp_settings_get_personal_data_expiration_date( WP_User_Request $request ) {
    266     /** This filter is documented in wp-admin/includes/file.php */
     266    /** This filter is documented in wp-includes/functions.php */
    267267    $expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
    268268
     
    291291 */
    292292function bp_settings_get_personal_data_export_url( WP_User_Request $request ) {
    293     return get_post_meta( $request->ID, '_export_file_url', true );
     293    if ( ! bp_settings_personal_data_export_exists( $request ) ) {
     294        return '';
     295    }
     296
     297    $file = get_post_meta( $request->ID, '_export_file_name', true );
     298    return wp_privacy_exports_url() . $file;
    294299}
    295300
     
    303308 */
    304309function bp_settings_personal_data_export_exists( WP_User_Request $request ) {
    305     $file = get_post_meta( $request->ID, '_export_file_path', true );
    306     return file_exists( $file );
     310    $file = get_post_meta( $request->ID, '_export_file_name', true );
     311    if ( empty( $file ) ) {
     312        return false;
     313    }
     314
     315    return file_exists( wp_privacy_exports_dir() . $file );
    307316}
    308317
Note: See TracChangeset for help on using the changeset viewer.