BP_Document_Component::setup_nav( array $main_nav = array(), array $sub_nav = array() )
Set up component navigation.
Description
See also
- BP_Component::setup_nav(): for a description of arguments.
Parameters
- $main_nav
-
(Optional) See BP_Component::setup_nav() for description.
Default value: array()
- $sub_nav
-
(Optional) See BP_Component::setup_nav() for description.
Default value: array()
Source
File: bp-document/classes/class-bp-document-component.php
public function setup_nav( $main_nav = array(), $sub_nav = array() ) { if ( bp_is_active( 'media' ) && bp_is_profile_document_support_enabled() ) { // Determine user to use. if ( bp_displayed_user_domain() ) { $user_domain = bp_displayed_user_domain(); } elseif ( bp_loggedin_user_domain() ) { $user_domain = bp_loggedin_user_domain(); } else { return; } $slug = bp_get_document_slug(); $document_link = trailingslashit( $user_domain . $slug ); // Only grab count if we're on a user page and current user has access. if ( bp_is_user() ) { $nav_name = __( 'Documents', 'buddyboss' ); } else { $nav_name = __( 'Documents', 'buddyboss' ); } // Add 'Documents' to the main navigation. $main_nav = array( 'name' => $nav_name, 'slug' => $slug, 'position' => 90, 'screen_function' => 'document_screen', 'default_subnav_slug' => 'my-document', 'item_css_id' => $this->id, ); // Add the subnav items to the profile. $sub_nav[] = array( 'name' => $nav_name, 'slug' => 'my-document', 'parent_url' => $document_link, 'parent_slug' => $slug, 'screen_function' => 'document_screen', 'position' => 10, 'item_css_id' => 'document-my-documents', ); } parent::setup_nav( $main_nav, $sub_nav ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.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.