BP_Invitation_Manager::send_request_notification_by_id( int $request_id, array $args = array() )

Send a request notification.


Parameters Parameters

$request_id

(int) (Required) ID of request to send.

$args

(array) (Optional) See BP_Invitation::mark_sent().

Default value: array()


Top ↑

Return Return

(bool) The result of run_send_action().


Source Source

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

	public function send_request_notification_by_id( $request_id = 0, $args = array() ) {
		$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.
		 */
		$invite_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( $invite_args );

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

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

		if ( $success ) {
			BP_Invitation::mark_sent( $request->id, $args );
		}

		return $success;
	}


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.