bp_nouveau_get_nav_scope()

Retrieve the specific scope for the current nav item.

Description

Return

(string) the specific scope of the nav.

Source

File: bp-templates/bp-nouveau/includes/template-tags.php

	function bp_nouveau_get_nav_scope() {
		$bp_nouveau = bp_nouveau();
		$nav_item   = $bp_nouveau->current_nav_item;
		$scope      = array();

		if ( 'directory' === $bp_nouveau->displayed_nav ) {
			$scope = array( 'data-bp-scope' => $nav_item->slug );

		} elseif ( 'personal' === $bp_nouveau->displayed_nav && ! empty( $nav_item->secondary ) ) {
			$scope = array( 'data-bp-user-scope' => $nav_item->slug );

		} else {
			/**
			 * Filter to add your own scope.
			 *
			 * @since BuddyPress 3.0.0
			 *
			 * @param array $scope     Contains the key and the value for your scope.
			 * @param object $nav_item The current nav item object.
			 * @param string $value    The current nav in use (eg: 'directory', 'groups', 'personal', etc..).
			 */
			$scope = apply_filters( 'bp_nouveau_set_nav_scope', $scope, $nav_item, $bp_nouveau->displayed_nav );
		}

		if ( ! $scope ) {
			return '';
		}

		return bp_get_form_field_attributes( 'scope', $scope );
	}

Changelog

Changelog
Version Description
BuddyPress 3.0.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.