BP_Groups_Invitation_Manager::allow_invitation( $args )

Should this invitation be created?


Parameters Parameters

$args.

(array) (Required)


Top ↑

Return Return

(bool)


Source Source

File: bp-groups/classes/class-bp-groups-invitation-manager.php

	public function allow_invitation( $args ) {
		// Does the inviter have this capability?
		if ( ! bp_user_can( $args['inviter_id'], 'groups_send_invitation', array( 'group_id' => $args['item_id'] ) ) ) {
			return false;
		}

		// Is the invited user eligible to receive an invitation?
		if ( ! bp_user_can( $args['user_id'], 'groups_receive_invitation', array( 'group_id' => $args['item_id'] ) ) ) {
			return false;
		}

		// Prevent duplicated invitations.
		if ( groups_check_has_invite_from_user( $args['user_id'], $args['item_id'], $args['inviter_id'], 'all' ) ) {
			return false;
		}

		return true;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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