bp_media_default_scope( string $scope )

Get default scope for the media.

Description

Parameters

$scope

(Required) Default scope.

Return

(string)

Source

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

2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
function bp_media_default_scope( $scope ) {
 
    $new_scope = array();
 
    if ( ( 'all' === $scope || empty( $scope ) ) && bp_is_media_directory() ) {
        $new_scope[] = 'public';
 
        if ( bp_is_active( 'friends' ) && bp_is_profile_media_support_enabled() ) {
            $new_scope[] = 'friends';
        }
 
        if ( bp_is_active( 'groups' ) && bp_is_group_media_support_enabled() ) {
            $new_scope[] = 'groups';
        }
 
        if ( is_user_logged_in() && bp_is_profile_media_support_enabled() ) {
            $new_scope[] = 'personal';
        }
 
    } elseif ( bp_is_user_media() && ( 'all' === $scope || empty( $scope ) ) && bp_is_profile_media_support_enabled() ) {
        $new_scope[] = 'personal';
    }
 
    $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_media_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.