Skip to:
Content
Pages
Categories
Search
Top
Bottom

Tip: improve top nav – add My Profile which includes activity and profile

  • Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    This is just a quick hint on how to improve the top navigation to be more user friendly. (and more similar to facebook, which people are familiar with)

    The top nav in the new BuddyPress theme is great. I love the simple rounded tabs. I like the very admin bar as well, but it is hidden, so new users don’t see it right away. I replaced the top Activity tag with My Profile and linked this page to the My Account page, thereby quickly giving users the ability to see all their settings and activity in one place.

    you first need to create a child theme if you’ve not already done so. Any live site will want to look different and use a child theme. There is a great tutorial on how to do that here: http://codex.buddypress.org/how-to-guides/building-a-buddypress-child-theme/

    next edit the header.php in your child theme.

    find the 6 lines of code pertaining to the activity tab starting on line 51:

    <?php if ( 'activity' != bp_dtheme_page_on_front() && bp_is_active( 'activity' ) ) : ?>

    replace that 6 line chunk with this

    <li<?php if ( bp_loggedin_user_id() == bp_displayed_user_id() ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo bp_loggedin_user_domain() ?>" title="<?php _e( 'My Profile', 'buddypress' ) ?>"><?php _e( 'My Profile', 'buddypress' ) ?></a>
    </li>

    edit the name of the tab in the above code as you see fit, maybe you want ‘My Account’ or ‘Activity & Profile’ whatever.

    finally, a little further down, change this line

    <li<?php if ( bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ) : ?> class="selected"<?php endif; ?>>

    to

    <li<?php if ( ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) && ( bp_loggedin_user_id() != bp_displayed_user_id() ) ) : ?> class="selected"<?php endif; ?>>

    that just makes it so that two tabs are not highlighted at the same time.

    enjoy.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    CORRECTION to work well with logged-out users:

    the first chunk should contain an if statement to only show the My Profile if the user is logged in:

    <?php if ( bp_loggedin_user_id() ) : ?>
    <li<?php if ( bp_loggedin_user_id() == bp_displayed_user_id() ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo bp_loggedin_user_domain() ?>" title="<?php _e( 'My Profile', 'buddypress' ) ?>"><?php _e( 'My Profile', 'buddypress' ) ?></a>
    </li>
    <?php endif; ?>

    and the second part for the members section should be this line, instead of the line I mentioned above:

    <li<?php if ( ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) && ( bp_loggedin_user_id() != bp_displayed_user_id() || !bp_loggedin_user_id() ) ) : ?> class="selected"<?php endif; ?>>

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    I’ve done this tip to my own child theme, Dwenaus.

    I might be using a slight variation on what you posted though.

    Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    hey, let me know if you find improvements. post ‘em here if you do :)

    Avatar of r-a-y
    r-a-y
    Moderator

    @r-a-y

    Here’s what I’m using for:

    My Profile tab:

    <?php if(is_user_logged_in()) : ?>
    <li<?php if ( bp_is_my_profile() ): ?> class="selected"<?php endif; ?>>
    <a href="<?php echo bp_get_loggedin_user_link(); ?>" title="<?php _e( 'My Profile', 'buddypress' ) ?>"><?php _e( 'My Profile', 'buddypress' ) ?></a>
    </li>
    <?php endif; ?>

    Members tab:

    <li<?php if ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() && !bp_is_my_profile()) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>/<?php echo BP_MEMBERS_SLUG ?>/" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a>
    </li>

    Slightly simpler than yours. But if there’s an even, simpler way let me know!

    Avatar of abcde666
    abcde666
    Participant

    @erich73

    interesting idea.

    Could you please provide a Screenshot of how this looks like ?

    Many thanks

    Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

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

You must be logged in to reply to this topic.