bp_groups_pending_received_invitations_personal_data_exporter( string $email_address, int $page )

Finds and exports data on pending group invitations received by a user 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-groups/bp-groups-functions.php

function bp_groups_pending_received_invitations_personal_data_exporter( $email_address, $page ) {
	$number = 20;

	$email_address = trim( $email_address );

	$data_to_export = array();

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

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

	$invitations = groups_get_invites( array(
		'user_id'  => $user->ID,
		'page'     => $page,
		'per_page' => $number,
	) );

	foreach ( $invitations as $invitation ) {
		$group = groups_get_group( $invitation->item_id );

		$item_data = array(
			array(
				'name'  => __( 'Group Name', 'buddypress' ),
				'value' => bp_get_group_name( $group ),
			),
			array(
				'name'  => __( 'Group URL', 'buddypress' ),
				'value' => bp_get_group_permalink( $group ),
			),
			array(
				'name'  => __( 'Invited By', 'buddypress' ),
				'value' => bp_core_get_userlink( $invitation->inviter_id ),
			),
			array(
				'name'  => __( 'Date Sent', 'buddypress' ),
				'value' => $invitation->date_modified,
			),
		);

		$data_to_export[] = array(
			'group_id'    => 'bp_groups_pending_received_invitations',
			'group_label' => __( 'Pending Group Invitations (Received)', 'buddypress' ),
			'item_id'     => "bp-group-pending-received-invitation-{$group->id}",
			'data'        => $item_data,
		);
	}

	// Tell core if we have more items to process.
	$done = count( $invitations ) < $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.