bp_settings_get_personal_data_request( $user_id )

Fetches a user’s personal data request.


Parameters Parameters

(int) (Required) WP user ID.


Top ↑

Return Return

(WP_User_Request|false) WP_User_Request object on success, boolean false on failure.


Source Source

File: bp-settings/bp-settings-functions.php

function bp_settings_get_personal_data_request( $user_id = 0 ) {
	if ( empty( $user_id ) ) {
		$user_id = bp_displayed_user_id();
	}

	if ( empty( $user_id ) ) {
		return false;
	}

	$user = get_userdata( $user_id );
	if ( empty( $user ) ) {
		return false;
	}

	$query = new WP_Query( array(
		'author'        => (int) $user_id,
		'post_type'     => 'user_request',
		'post_status'   => 'any',
		'post_name__in' => array(
			'export_personal_data',
		),
	) );

	if ( ! empty( $query->post ) ) {
		// WP 5.4 changed the user request function name to wp_get_user_request()
		$user_request = bp_is_running_wp( '4.9.6' ) ? 'wp_get_user_request' : 'wp_get_user_request_data';
		return $user_request( $query->post->ID );
	} else {
		return false;
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.