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

Accept a pending group membership request.


Parameters Parameters

$membership_id

(int) (Required) Deprecated 5.0.0.

$user_id

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

$group_id

(int) (Required) Required. 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_accept_membership_request( $membership_id, $user_id = 0, $group_id = 0 ) {

	if ( ! empty( $membership_id ) ) {
		/* translators: 1: the name of the method. 2: the name of the file. */
		_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 ( ! $user_id || ! $group_id ) {
		return false;
	}

	$invites_class = new BP_Groups_Invitation_Manager();
	$args = array(
		'user_id' => $user_id,
		'item_id' => $group_id,
	);

	return $invites_class->accept_request( $args );
}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Deprecated $membership_id argument.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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