bp_document_default_scope( string $scope = 'all' )

Get default scope for the document.

Description

Parameters

$scope

(Optional) Default scope.

Default value: 'all'

Return

(string)

Source

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

3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
function bp_document_default_scope( $scope = 'all' ) {
    $new_scope = array();
 
    if ( ( 'all' === $scope || empty( $scope ) ) && bp_is_document_directory() ) {
        $new_scope[] = 'public';
        if ( is_user_logged_in() ) {
            $new_scope[] = 'personal';
 
            if ( bp_is_active( 'friends' ) ) {
                $new_scope[] = 'friends';
            }
        }
 
        if ( bp_is_active( 'groups' ) ) {
            $new_scope[] = 'groups';
        }
 
    } elseif ( bp_is_user() && ( 'all' === $scope || empty( $scope ) ) ) {
        $new_scope[] = 'personal';
    } elseif ( bp_is_active( 'groups' ) && bp_is_group() && ( 'all' === $scope || empty( $scope ) ) ) {
        $new_scope[] = 'groups';
    }
 
    $new_scope = array_unique( $new_scope );
 
    if ( empty( $new_scope ) ) {
        $new_scope = (array) $scope;
    }
 
    /**
     * Filter to update default scope.
     *
     * @since BuddyBoss 1.4.4
     */
    $new_scope = apply_filters( 'bp_document_default_scope', $new_scope );
 
    return implode( ',', $new_scope );
 
}

Changelog

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