bp_document_get( array|string $args = '' )

Retrieve an document or documents.

Description

The bp_document_get() function shares all arguments with BP_Document::get(). The following is a list of bp_document_get() parameters that have different default values from BP_Document::get() (value in parentheses is the default for the bp_document_get()).

  • ‘per_page’ (false)

See also

  • BP_Document::get(): For more information on accepted arguments and the format of the returned value.

Parameters

$args

(Optional) See BP_Document::get() for description.

Default value: ''

Return

(array) $document See BP_Document::get() for description.

Source

File: bp-document/bp-document-functions.php

335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
function bp_document_get( $args = '' ) {
 
    $r = bp_parse_args(
        $args,
        array(
            'max'                 => false,        // Maximum number of results to return.
            'fields'              => 'all',
            'page'                => 1,            // Page 1 without a per_page will result in no pagination.
            'per_page'            => false,        // results per page.
            'sort'                => 'DESC',       // sort ASC or DESC.
            'order_by'            => false,        // order by.
            'scope'               => false,
 
            // want to limit the query.
            'user_id'             => false,
            'activity_id'         => false,
            'folder_id'           => false,
            'group_id'            => false,
            'search_terms'        => false,        // Pass search terms as a string.
            'privacy'             => false,        // privacy of document.
            'exclude'             => false,        // Comma-separated list of activity IDs to exclude.
            'count_total'         => false,
            'user_directory'      => true,
 
            'meta_query_document' => false,         // Filter by activity meta. See WP_Meta_Query for format
            'meta_query_folder'   => false,          // Filter by activity meta. See WP_Meta_Query for format
        ),
        'document_get'
    );
 
    $document = BP_Document::documents(
        array(
            'page'                => $r['page'],
            'per_page'            => $r['per_page'],
            'user_id'             => $r['user_id'],
            'activity_id'         => $r['activity_id'],
            'folder_id'           => $r['folder_id'],
            'group_id'            => $r['group_id'],
            'max'                 => $r['max'],
            'sort'                => $r['sort'],
            'order_by'            => $r['order_by'],
            'search_terms'        => $r['search_terms'],
            'scope'               => $r['scope'],
            'privacy'             => $r['privacy'],
            'exclude'             => $r['exclude'],
            'count_total'         => $r['count_total'],
            'fields'              => $r['fields'],
            'user_directory'      => $r['user_directory'],
            'meta_query_document' => $r['meta_query_document'],
            'meta_query_folder'   => $r['meta_query_folder'],
        )
    );
 
    /**
     * Filters the requested document item(s).
     *
     * @param BP_Document $document Requested document object.
     * @param array       $r        Arguments used for the document query.
     *
     * @since BuddyBoss 1.4.0
     */
    return apply_filters_ref_array( 'bp_document_get', array( &$document, &$r ) );
}

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.