groups_reject_invite( int $user_id, int $group_id, int $inviter_id = false )

Reject a group invitation.


Parameters Parameters

$user_id

(int) (Required) ID of the user.

$group_id

(int) (Required) ID of the group.

$inviter_id

(int) (Optional) ID of the inviter.

Default value: false


Top ↑

Return Return

(bool) True on success, false on failure.


Source Source

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

function groups_reject_invite( $user_id, $group_id, $inviter_id = false ) {
	if ( empty( $user_id ) || empty( $group_id ) ) {
		return false;
	}

	$invites_class = new BP_Groups_Invitation_Manager();
	$success       = $invites_class->delete( array(
		'user_id'    => $user_id,
		'item_id'    => $group_id,
		'inviter_id' => $inviter_id,
	) );

	/**
	 * Fires after a user rejects a group invitation.
	 *
	 * @since 1.0.0
	 * @since 5.0.0 The $inviter_id arg was added.
	 *
	 * @param int $user_id    ID of the user rejecting the invite.
	 * @param int $group_id   ID of the group being rejected.
	 * @param int $inviter_id ID of the inviter.
	 */
	do_action( 'groups_reject_invite', $user_id, $group_id, $inviter_id );

	return $success;
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 The $inviter_id arg was added.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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