Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile tab dropdown menus


  • defunct
    Participant

    @defunctlife

    Hello,

    Has anyone seen this done before or know the best way to accomplish this? I see both navs have their own functions to build their respective menus (`bp_get_displayed_user_nav()` and `bp_get_options_nav()`) but is there any way to build a nested

      using these 2 functions?

      Thank you

Viewing 2 replies - 1 through 2 (of 2 total)

  • ajaxmac
    Participant

    @ajaxmac

    HI – I was wanting to do the same thing , and made my own functions from the two mentioned here:
    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-edit-user-and-options-nav

    Then edited my template files to create my own sidebar and call my function:

    
    /*
    / Create nested navigation items
    /
    <hr class="bbcode_rule" />
    */
    
    function my_bp_get_nav_nested() {
    global $bp, $current_blog;
    
    /* Loop through each navigation item */
    foreach( (array) $bp->bp_nav as $nav_item ) {
    /* If the current component matches the nav item id, then add a highlight CSS class. */
    if ( !bp_is_directory() && $bp->active_components[$bp->current_component] == $nav_item ) {
    $selected = ' class="current selected"';
    //Get the sub-navigation items if currently selected
    $subnav_item = my_bp_get_options_nav() ;
    } else {
    $selected = '';
    $subnav_item = '' ;
    }
    /* If we are viewing another person (current_userid does not equal loggedin_user->id)
    then check to see if the two users are friends. if they are, add a highlight CSS class
    to the friends nav item if it exists. */
    if ( !bp_is_my_profile() && $bp->displayed_user->id ) {
    $selected = '';
    
    if ( function_exists('friends_install') ) {
    if ( $nav_item == $bp->friends->id ) {
    if ( friends_check_friendship( $bp->loggedin_user->id, $bp->displayed_user->id ) )
    $selected = ' class="current selected"';
    }
    }
    }
    
    /* echo out the final list item */
    echo apply_filters( 'bp_get_loggedin_user_nav_' . $nav_item, '<li id="li-nav-' . $nav_item . '"><a id="my-' . $nav_item . '" href="' . $nav_item . '">' . $nav_item . '</a></li>', &$nav_item ) . $subnav_item ;
    
    }
    
    /* Always add a log out list item to the end of the navigation */
    if ( function_exists( 'wp_logout_url' ) ) {
    $logout_link = '<li><a id="wp-logout">root_domain ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
    } else {
    $logout_link = '<li><a id="wp-logout">root_domain . '">' . __( 'Log Out', 'buddypress' ) . '</a></li>';
    }
    
    echo apply_filters( 'bp_logout_nav_link', $logout_link );
    
    }
    
    /*
    / Edited bp_get_options_nav() to return a string
    / rather than printing directly to screen
    /
    <hr class="bbcode_rule" />
    */
    
    function my_bp_get_options_nav() {
    global $bp;
    
    if ( count( $bp->bp_options_nav[$bp->current_component] ) < 1 )
    return false;
    
    /* Loop through each navigation item */
    foreach ( (array)$bp->bp_options_nav[$bp->current_component] as $subnav_item ) {
    if ( !$subnav_item )
    continue;
    
    /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */
    if ( $subnav_item == $bp->current_action ) {
    $selected = ' class="current selected"';
    } else {
    $selected = '';
    }
    
    /* echo out the final list item */
    $subnav_item_render = $subnav_item_render . apply_filters( 'bp_get_options_nav_' . $subnav_item, '<li id="' . $subnav_item . '-personal-li"><a id="' . $subnav_item . '" href="' . $subnav_item . '">' . $subnav_item . '</a></li>', $subnav_item );
    }
    return '<ul class="subnav">' . $subnav_item_render . '</ul>' ;
    }

    Hi,
    How do you call your function ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Profile tab dropdown menus’ is closed to new replies.
Skip to toolbar