BP_Document::populate()

Populate the object with data about the specific document item.

Description

Source

File: bp-document/classes/class-bp-document.php

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
public function populate() {
 
    global $wpdb;
 
    $row = wp_cache_get( $this->id, 'bp_document' );
 
    if ( false === $row ) {
        $bp  = buddypress();
        $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->document->table_name} WHERE id = %d", $this->id ) ); // db call ok; no-cache ok;
 
        wp_cache_set( $this->id, $row, 'bp_document' );
    }
 
    if ( empty( $row ) ) {
        $this->id = 0;
 
        return;
    }
 
    $this->id            = (int) $row->id;
    $this->blog_id       = (int) $row->blog_id;
    $this->attachment_id = (int) $row->attachment_id;
    $this->user_id       = (int) $row->user_id;
    $this->title         = $row->title;
    $this->folder_id     = (int) $row->folder_id;
    $this->group_id      = (int) $row->group_id;
    $this->activity_id   = (int) $row->activity_id;
    $this->privacy       = $row->privacy;
    $this->menu_order    = (int) $row->menu_order;
    $this->date_created  = $row->date_created;
    $this->date_modified = $row->date_modified;
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.0 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.