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

1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
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.