BP_Invites_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-invites/classes/class-bp-invites-component.php
public function setup_nav( $main_nav = array(), $sub_nav = array() ) { if ( is_user_logged_in() ) { // 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 { $user_domain = false; } $nav_name = __( 'Email Invites', 'buddyboss' ); $slug = bp_get_invites_slug(); if ( ! empty( $user_domain ) ) { $access = bp_core_can_edit_settings(); $invites_link = trailingslashit( $user_domain . $slug ); if ( $access ) { if ( true === bp_allow_user_to_send_invites() ) { // Add 'Send Invites' to the main navigation. $main_nav = array( 'name' => $nav_name, 'slug' => $slug, 'position' => 90, 'screen_function' => 'bp_invites_screen_send_invite', 'default_subnav_slug' => 'send-invites', 'user_has_access' => $access, 'item_css_id' => $this->id, ); // Add the Invite by Email nav item. $sub_nav[] = array( 'name' => __( 'Send Invites', 'buddyboss' ), 'slug' => 'send-invites', 'parent_url' => $invites_link, 'parent_slug' => $slug, 'screen_function' => 'bp_invites_screen_send_invite', 'user_has_access' => $access, 'position' => 10, 'item_css_id' => 'invites-send-invite' ); // Add the Sent Invites nav item. $sub_nav[] = array( 'name' => __( 'Sent Invites', 'buddyboss' ), 'slug' => 'sent-invites', 'parent_url' => $invites_link, 'parent_slug' => $slug, 'screen_function' => 'bp_invites_screen_sent_invite', 'user_has_access' => $access, 'position' => 30, 'item_css_id' => 'invites-sent-invites' ); } } parent::setup_nav( $main_nav, $sub_nav ); } } }
Changelog
Version | Description |
---|---|
BuddyBoss 1.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.