BP_Invitation_Manager::accept_invitation( $args = array() )

Accept invitation, based on provided filter parameters.

Description

See also

Parameters

$update_args

(Required) Associative array of fields to update, and the values to update them to. Of the format array( 'user_id' => 4 )

Return

(int|bool) Number of rows updated on success, false on failure.

Source

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

461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
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
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.