Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddybar Account Menu CSS help.


  • enderpal444
    Participant

    @enderpal444

    Ok Im trying to replace the label “Account Menu” in the Buddybar with the name of the avatar of the logged in user and the username. I have that part working but my problem is finding a way to select the username in that string so I can center the text between the height of the avatar much like Facebook. Ive tried using the last-child property and I tired putting span tags around the username in the php but I can’t get it to work. How can I go about this? Heres the snippet from the Buddybar code as I have it.

    // **** "My Account" Menu ******
    function bp_adminbar_account_menu() {
    global $bp;
    
    if ( !$bp->bp_nav || !is_user_logged_in() )
    return false;
    
    echo '<li id="bp-adminbar-account-menu"><a href="' . bp_loggedin_user_domain() . '">';
    bp_loggedin_user_avatar( 'type=thumb&width=30&height=30' );
    echo bp_core_get_userlink( bp_loggedin_user_id() ) . '</a>';
    echo '<ul>';
    
    // Loop through each navigation item
    $counter = 0;
    foreach( (array)$bp->bp_nav as $nav_item ) {
    $alt = ( 0 == $counter % 2 ) ? ' class="alt"' : '';
    
    if ( -1 == $nav_item )
    continue;
    
    echo '<li>';
Viewing 1 replies (of 1 total)

  • enderpal444
    Participant

    @enderpal444

    Alright so I did a real hack job with the css but it works. If you want to do something like this you can use the above snippet and then I added the following css which you’ll have to play with to make it line up.

    `#wp-admin-bar ul li#bp-adminbar-account-menu{background: url(images/admin-menu-arrow.gif) 100% 48% no-repeat;}
    #wp-admin-bar ul li#bp-adminbar-account-menu a img{padding: 0px 0px 0px 0px;margin-top:-5px}
    #wp-admin-bar ul li#bp-adminbar-account-menu a{vertical-align: top;display:inline-block;padding: 5px 0px 0px 0px;margin-top:0px}
    #wp-admin-bar ul li#bp-adminbar-account-menu li a{display:inline-block;padding: 5px 15px 5px 15px;margin-top:0px}`

Viewing 1 replies (of 1 total)
  • The topic ‘Buddybar Account Menu CSS help.’ is closed to new replies.
Skip to toolbar