BP_Invitation_Manager::send_invitation_by_id( int $invitation_id )
Send an invitation notification.
Description
Parameters
- $invitation_id
-
(Required) ID of invitation 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_invitation_by_id( $invitation_id = 0 ) {
$updated = false;
$invitation = new BP_Invitation( $invitation_id );
if ( ! $invitation->id ) {
return false;
}
/**
* Fires before an invitation is sent.
*
* @since BuddyBoss 1.3.5
*
* @param BP_Invitation object $invitation Invitation about to be sent.
*/
do_action( 'bp_invitations_send_invitation_by_id_before_send', $invitation );
/*
* Before sending an invitation, check for outstanding requests to the same item.
* A sent invitation + a request = acceptance.
*/
$request_args = array(
'user_id' => $invitation->user_id,
'invitee_email' => $invitation->invitee_email,
'item_id' => $invitation->item_id,
'secondary_item_id' => $invitation->secondary_item_id,
);
$request = $this->request_exists( $request_args );
if ( ! empty( $request ) ) {
// Accept the request.
return $this->accept_request( $request_args );
}
// Perform the send action.
$this->run_send_action( $invitation );
$updated = BP_Invitation::mark_sent( $invitation->id );
return $updated;
}
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.