BP_Document::get_folder_document_ids( bool $folder_id = false )

Get all document ids for the folder.

Description

Parameters

$folder_id

(Optional)

Default value: false

Return

(array|bool)

Source

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

1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
public static function get_folder_document_ids( $folder_id = false ) {
    global $bp, $wpdb;
 
    if ( ! $folder_id ) {
        return false;
    }
 
    $folder_document_sql = $wpdb->prepare( "SELECT DISTINCT d.id FROM {$bp->document->table_name} d WHERE d.folder_id = %d", $folder_id );
 
    $cached = bp_core_get_incremented_cache( $folder_document_sql, 'bp_document' );
 
    if ( false === $cached ) {
        $document_ids = $wpdb->get_col( $folder_document_sql ); // db call ok; no-cache ok;
        bp_core_set_incremented_cache( $folder_document_sql, 'bp_document', $document_ids );
    } else {
        $document_ids = $cached;
    }
 
    return (array) $document_ids;
}

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.