groups_reject_membership_request( int $membership_id, int $user_id, int $group_id )

Reject a pending group membership request.

Description

Parameters

$membership_id

(Required) Deprecated BuddyPress 1.3.5.

$user_id

(Optional) ID of the user who requested membership. Provide this value along with $group_id to override $membership_id.

$group_id

(Optional) ID of the group to which membership is being requested. Provide this value along with $user_id to override $membership_id.

Return

(bool) True on success, false on failure.

Source

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

function groups_reject_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {
	if ( !$membership = groups_delete_membership_request( $membership_id, $user_id, $group_id ) ) {
		return false;
	}

	/**
	 * Fires after a group membership request has been rejected.
	 *
	 * @since BuddyPress 1.0.0
	 *
	 * @param int  $user_id  ID of the user who rejected membership.
	 * @param int  $group_id ID of the group that was rejected membership to.
	 * @param bool $value    If membership was accepted.
	 */
	do_action( 'groups_membership_rejected', $membership->user_id, $membership->group_id, false );

	return true;
}

Changelog

Changelog
Version Description
BuddyPress 1.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.