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

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.