bp_activity_default_scope( string $scope = 'all' )

Get default scope for the activity

Description

Parameters

$scope

(Optional) Default scope.

Default value: 'all'

Return

(string)

Source

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

5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
function bp_activity_default_scope( $scope = 'all' ) {
    $new_scope = array();
 
    if ( bp_loggedin_user_id() && ( 'all' === $scope || empty( $scope ) ) ) {
 
        $new_scope[] = 'public';
 
        if ( bp_is_activity_directory() || bp_is_single_activity() ) {
            $new_scope[] = 'just-me';
 
            if ( bp_is_activity_directory() ) {
                $new_scope[] = 'public';
            }
 
            if ( bp_activity_do_mentions() ) {
                $new_scope[] = 'mentions';
            }
 
            if ( bp_is_active( 'friends' ) ) {
                $new_scope[] = 'friends';
            }
 
            if ( bp_is_active( 'groups' ) ) {
                $new_scope[] = 'groups';
            }
 
            if ( bp_is_activity_follow_active() ) {
                $new_scope[] = 'following';
            }
 
            if ( bp_is_single_activity() && bp_is_active( 'media' ) ) {
                $new_scope[] = 'media';
                $new_scope[] = 'document';
            }
 
        } else if ( bp_is_user_activity() ) {
            if ( empty( bp_current_action() ) ) {
                $new_scope[] = 'just-me';
            } else {
                $new_scope[] = bp_current_action();
            }
        } else if ( bp_is_active( 'group' ) && bp_is_group_activity() ) {
            $new_scope[] = 'groups';
        }
 
    } else if( ! bp_loggedin_user_id() && ( 'all' === $scope || empty( $scope ) ) ) {
        $new_scope[] = 'public';
    }
 
    $new_scope = array_unique( $new_scope );
 
    if ( empty( $new_scope ) ) {
        $new_scope = (array) $scope;
    }
 
    /**
     * Filter to update default scope.
     *
     * @since BuddyBoss 1.4.3
     */
    $new_scope = apply_filters( 'bp_activity_default_scope', $new_scope );
 
    return implode( ',', $new_scope );
 
}

Changelog

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