BP_Invitation_Manager::accept_invitation( array $args = array() )
Accept invitation, based on provided filter parameters.
Description Description
See also See also
- BP_Invitation::get(): for a description of accepted update/where arguments.
Parameters Parameters
- $args
-
(Optional) Invitation characteristics. Some basic info is required to accept an invitation, because we'll need to accept all similar invitations and requests.
- 'user_id'
(int) User ID of the invitee. Either 'user_id' or 'invitee_email' is required. - 'invitee_email'
(string) Email address of the invitee. Either 'user_id' or 'invitee_email' is required. - 'item_id'
(int) Item ID of the invitation to accept. - 'secondary_item_id'
(int) Optional. Secondary item ID if needed. - 'invite_sent'
(string) Optional. Defaults to only allowing the acceptance of sent invitations. - 'date_modified'
(string) Modified time in 'Y-m-d h:i:s' format, GMT. Defaults to current time if not specified.
Default value: array()
- 'user_id'
Return Return
(int|bool) Number of rows updated on success, false on failure.
Source Source
File: bp-core/classes/class-bp-invitation-manager.php
public function accept_invitation( $args = array() ) { /* * Some basic info is required to accept an invitation, * because we'll need to mark all similar invitations and requests. * The following, except the optional 'secondary_item_id', are required. */ $r = bp_parse_args( $args, array( 'user_id' => 0, 'invitee_email' => '', 'item_id' => null, 'secondary_item_id' => null, 'invite_sent' => 'sent', ), 'accept_invitation' ); $r['class'] = $this->class_name; if ( ! ( ( $r['user_id'] || $r['invitee_email'] ) && $r['class'] && $r['item_id'] ) ) { return false; } if ( ! $this->invitation_exists( $r ) ) { return false; } $success = $this->run_acceptance_action( 'invite', $r ); if ( $success ) { // Mark invitations & requests to this item for this user. $this->mark_accepted( $r ); // Allow plugins an opportunity to act on the change. do_action( 'bp_invitations_accepted_invite', $r ); } return $success; }
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |