/**
 * bp_get_options_nav()
 * TEMPLATE TAG
 *
 * Uses the $bp->bp_options_nav global to render out the sub navigation for the current component.
 * Each component adds to its sub navigation array within its own [component_name]_setup_nav() function.
 * 
 * This sub navigation array is the secondary level navigation, so for profile it contains:
 *      [Public, Edit Profile, Change Avatar]
 *
 * The function will also analyze the current action for the current component to determine whether
 * or not to highlight a particular sub nav item.
 * 
 * @package BuddyPress Core
 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
 * @uses bp_get_user_nav() Renders the navigation for a profile of a currently viewed user.
 */
function bp_get_options_nav()
{
    global $bp;
    /***
     * Only render this navigation when the logged in user is looking at one of their own pages, or we are using it to display nav
     * menus for something like a group, or event.
     */
    if (bp_is_home() || $bp->is_single_item) {
        if (count($bp->bp_options_nav[$bp->current_component]) < 1) {
            return false;
        }
        /* Loop through each navigation item */
        foreach ($bp->bp_options_nav[$bp->current_component] as $slug => $values) {
            $title = $values['name'];
            $link = $values['link'];
            $css_id = $values['css_id'];
            /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */
            if ($slug == $bp->current_action || in_array($slug, $bp->action_variables)) {
                $selected = ' class="current"';
            } else {
                $selected = '';
            }
            /* echo out the final list item */
            echo '<li' . $selected . '><a id="' . $css_id . '" href="' . $link . '">' . $title . '</a></li>';
        }
    } else {
        if (!$bp->bp_users_nav) {
            return false;
        }
        bp_get_user_nav();
    }
}
Esempio n. 2
0
			<?php 
do_action('bp_before_member_plugin_template');
?>

			<div id="item-header">
				<?php 
locate_template(array('members/single/member-header.php'), true);
?>
			</div>

			<div id="item-nav">
				<div class="item-list-tabs no-ajax" id="sub-nav">
					<ul>
						<?php 
bp_get_user_nav();
?>

						<?php 
do_action('bp_members_directory_member_types');
?>
					</ul>
				</div>
			</div>

			<div id="item-body">

				<div class="item-list-tabs no-ajax" id="subnav">
					<ul>
						<?php 
bp_get_options_nav();