Skip to:
Content
Pages
Categories
Search
Top
Bottom

Highlight current_selected not working on sidebar !


  • Brendavo
    Member

    @successful-life

    Hi.
    I have a small problem or bug, i created a sidebar on the left side and inserted bp_get_loggedin_user_nav(); in it to show the user nav in the sidebar !
    Everything works, but if i go on activity or any link, the class “current_selected” is not applied and the link does not get highlighted in the sidebar!
    But it does get highlighted in the .padder div area ( as in default bp theme ).

    My sidebar html:

    <div id="profile-menu">
    
    <span class="bbw-user-link"><a href=&quot;"></a></span>
    <ul class="bbw-avatar">
    <li></li>
    </ul>
    
    <div id="side_nav">
    <div class="menu-list-tabs no-ajax" id="object-nav">
    <ul>
    
    </ul>
    </div>
    </div>
    
    </div>

    P.s. My php skills are limited and this it the first time i use buddypress… i have no clue about the that are all around in the template files… could the highlight not work because of them?

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

  • Brendavo
    Member

    @successful-life

    could not edit the prev post.
    The code for the highlight is i think in bp-members-template.php on line 704

    function bp_get_loggedin_user_nav() {
    global $bp;
    
    // 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"';
    else
    $selected = '';
    
    /* 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 ( bp_is_active( 'friends' ) ) {
    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_ref_array( 'bp_get_loggedin_user_nav_' . $nav_item, array( '<li id="li-nav-' . $nav_item . '"><div class="menu-img-' . $nav_item . '"><a id="my-' . $nav_item . '" href="' . $nav_item . '">' . $nav_item . '</a></div></li>', &$nav_item ) );
    }
    
    // Always add a log out list item to the end of the navigation
    $logout_link = '<li><div class="menu-img-logout"><a id="wp-logout" href="' .  wp_logout_url( bp_get_root_domain() ) . '">' . __( 'Log Out', 'buddypress' ) . '</a></div></li>';
    
    echo apply_filters( 'bp_logout_nav_link', $logout_link );
    }

    The strange thing is… the only highlight i get on the sidebar is, if i view a friends profile. so the part on line 715 works, but not the rest!


    Brendavo
    Member

    @successful-life

    bump!
    i am really stuck on this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Highlight current_selected not working on sidebar !’ is closed to new replies.
Skip to toolbar