bp_friends_pending_received_requests_personal_data_exporter( string $email_address, int $page )
Finds and exports pending received friendship request data associated with an email address.
Description Description
Parameters Parameters
- $email_address
-
(Required) The user's email address.
- $page
-
(Required) Batch number.
Return Return
(array) An array of personal data.
Source Source
File: bp-friends/bp-friends-functions.php
function bp_friends_pending_received_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,
'friend_user_id' => $user->ID,
'page' => $page,
'per_page' => $number,
) );
$user_data_to_export = array();
foreach ( $friendships as $friendship ) {
$item_data = array(
array(
'name' => __( 'Requester', 'buddypress' ),
'value' => bp_core_get_userlink( $friendship->initiator_user_id ),
),
array(
'name' => __( 'Date Sent', 'buddypress' ),
'value' => $friendship->date_created,
),
);
$data_to_export[] = array(
'group_id' => 'bp_friends_pending_received_requests',
'group_label' => __( 'Pending Friend Requests (Received)', 'buddypress' ),
'item_id' => "bp-friends-pending-received-request-{$friendship->initiator_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,
);
}
Changelog Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |