BP_Invitation::populate()

Fetch data for an existing invitation from the database.

Description

Source

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

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
public function populate() {
    global $wpdb;
    $invites_table_name = BP_Invitation_Manager::get_table_name();
 
    // Check cache for invitation data.
    $invitation = wp_cache_get( $this->id, 'bp_invitations' );
 
    // Cache missed, so query the DB.
    if ( false === $invitation ) {
        $invitation = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$invites_table_name} WHERE id = %d", $this->id ) );
        wp_cache_set( $this->id, $invitation,'bp_invitations' );
    }
 
    // No invitation found so set the ID and bail.
    if ( empty( $invitation ) || is_wp_error( $invitation ) ) {
        $this->id = 0;
        return;
    }
 
    $this->user_id           = (int) $invitation->user_id;
    $this->inviter_id        = (int) $invitation->inviter_id;
    $this->invitee_email     = $invitation->invitee_email;
    $this->class             = sanitize_key( $invitation->class );
    $this->item_id           = (int) $invitation->item_id;
    $this->secondary_item_id = (int) $invitation->secondary_item_id;
    $this->type              = $invitation->type;
    $this->content           = $invitation->content;
    $this->date_modified     = $invitation->date_modified;
    $this->invite_sent       = (int) $invitation->invite_sent;
    $this->accepted          = (int) $invitation->accepted;
 
}

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.