bp_members_invitations_delete_invites( intring $args = array() )

Delete a membership invitation.


Parameters Parameters

$args

(intring) (Optional) Array of arguments.

  • 'id'
    (int|array) Id(s) of the invitation(s) to remove.
  • 'invitee_email'
    (int) Email address of the user being invited.
  • 'network_id'
    (int) ID of the network to which the user is being invited.
  • 'inviter_id'
    (int) ID of the inviting user.
  • 'accepted'
    (int) Whether the invitation has been accepted yet.
  • 'invite_sent'
    (int) Whether the invitation has been sent yet.

Default value: array()


Top ↑

Return Return

(bool) True if all were deleted.


Source Source

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

function bp_members_invitations_delete_invites( $args = array() ) {
	$r = bp_parse_args(
		$args,
		array(
			'id'            => false,
			'invitee_email' => '',
			'network_id'    => get_current_network_id(),
			'inviter_id'    => null,
			'accepted'      => null,
			'invite_sent'   => null
		),
		'members_invitations_delete_invites'
	);

	$inv_args = array(
		'id'            => $r['id'],
		'invitee_email' => $r['invitee_email'],
		'item_id'       => $r['network_id'],
		'inviter_id'    => $r['inviter_id'],
		'accepted'      => $r['accepted'],
		'invite_sent'   => $r['invite_sent']
	);

	// Find the invitation(s).
	$invites     = bp_members_invitations_get_invites( $inv_args );
	$total_count = count( $invites );

	// Loop through, deleting each invitation.
	$deleted = 0;
	foreach ( $invites as $invite ) {
		$success = bp_members_invitations_delete_by_id( $invite->id );
		if ( $success ) {
			$deleted++;
		}
	}

	return $deleted === $total_count;
}


Top ↑

Changelog Changelog

Changelog
Version Description
8.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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