BP_Invitation_Manager::send_request_notification_by_id( int $request_id )

Send a request notification.

Description

Parameters

$request_id

(Required) ID of request to send.

Return

(int|bool) The number of rows updated, or false on error.

Source

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

	public function send_request_notification_by_id( $request_id = 0 ) {
		$updated = false;

		$request = new BP_Invitation( $request_id );

		if ( ! $request->id ) {
			return false;
		}

		// Different uses may need different actions on sending. Plugins can hook in here to perform their own tasks.
		do_action( 'bp_invitations_send_request_notification_by_id_before_send', $request_id, $request );

		/*
		 * Before sending notifications, check for outstanding invitations to the same item.
		 * A sent invitation + a request = acceptance.
		 */
		$args = array(
			'user_id'           => $request->user_id,
			'invitee_email'     => $request->invitee_email,
			'item_id'           => $request->item_id,
			'secondary_item_id' => $request->secondary_item_id,
			'invite_sent'       => 'sent'
		);
		$invites = $this->invitation_exists( $args );

		if ( ! empty( $invites ) ) {
			// Accept the request.
			return $this->accept_invitation( $args );
		}

		// Perform the send action.
		$this->run_send_action( $request );

		$updated = BP_Invitation::mark_sent( $request->id );

		return $updated;
	}

Changelog

Changelog
Version Description
BuddyBoss 1.3.5 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.