BP_REST_Account_Settings_Options_Endpoint::update_export_fields( WP_REST_Request $request )
Update Export fields “Export Data”.
Description
Parameters
- $request
-
(Required) Full details about the request.
Return
(array|bool|void)
Source
File: bp-settings/classes/class-bp-rest-account-settings-options-endpoint.php
public function update_export_fields( $request ) { $post_fields = $request->get_param( 'fields' ); $error = false; $notice = false; add_filter( 'bp_displayed_user_id', array( $this, 'bp_rest_get_displayed_user' ), 999 ); if ( isset( $post_fields['member-data-export-submit'] ) ) { $user_id = bp_loggedin_user_id(); $user = get_userdata( $user_id ); $request_id = wp_create_user_request( $user->data->user_email, 'export_personal_data' ); if ( is_wp_error( $request_id ) ) { $error = $request_id->get_error_message(); } elseif ( ! $request_id ) { $error = __( 'Unable to initiate the data export request.', 'buddyboss' ); } if ( empty( $error ) ) { wp_send_user_request( $request_id ); $notice = __( 'Please check your email to confirm the data export request.', 'buddyboss' ); } } remove_filter( 'bp_displayed_user_id', array( $this, 'bp_rest_get_displayed_user' ), 999 ); return array( 'error' => $error, 'notice' => $notice, ); }
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.