bp_friends_pending_sent_requests_personal_data_exporter( string $email_address, int $page )

Finds and exports pending sent friendship request data associated with an email address.


Description Description


Parameters Parameters

$email_address

(Required) The user's email address.

$page

(Required) Batch number.


Top ↑

Return Return

(array) An array of personal data.


Top ↑

Source Source

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

function bp_friends_pending_sent_requests_personal_data_exporter( $email_address, $page ) {
	$number = 50;

	$email_address = trim( $email_address );

	$data_to_export = array();

	$user = get_user_by( 'email', $email_address );

	if ( ! $user ) {
		return array(
			'data' => array(),
			'done' => true,
		);
	}

	$friendships = BP_Friends_Friendship::get_friendships( $user->ID, array(
		'is_confirmed'      => false,
		'initiator_user_id' => $user->ID,
		'page'              => $page,
		'per_page'          => $number,
	) );

	$user_data_to_export = array();

	foreach ( $friendships as $friendship ) {
		$item_data = array(
			array(
				'name'  => __( 'Recipient', 'buddypress' ),
				'value' => bp_core_get_userlink( $friendship->friend_user_id ),
			),
			array(
				'name'  => __( 'Date Sent', 'buddypress' ),
				'value' => $friendship->date_created,
			),
		);

		$data_to_export[] = array(
			'group_id'    => 'bp_friends_pending_sent_requests',
			'group_label' => __( 'Pending Friend Requests (Sent)', 'buddypress' ),
			'item_id'     => "bp-friends-pending-sent-request-{$friendship->friend_user_id}",
			'data'        => $item_data,
		);
	}

	// Tell core if we have more items to process.
	$done = count( $friendships ) < $number;

	return array(
		'data' => $data_to_export,
		'done' => $done,
	);
}

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.