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

Reject a pending group membership request.


Parameters Parameters

$membership_id

(int) (Required) Deprecated 5.0.0.

$user_id

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

$group_id

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


Top ↑

Return Return

(bool) True on success, false on failure.


Source Source

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

function groups_reject_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {

	if ( ! empty( $membership_id ) ){
		_deprecated_argument( __METHOD__, '5.0.0', sprintf( __( 'Argument `membership_id` passed to %1$s  is deprecated. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
	}

	if ( ! groups_delete_membership_request( false, $user_id, $group_id ) ) {
		return false;
	}

	/**
	 * Fires after a group membership request has been rejected.
	 *
	 * @since 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', $user_id, $group_id, false );

	return true;
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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