Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding a Profile Button to Navigation

  • @sofastop

    Member

    Hi,

    I am currently finishing of a website using BuddyPress.

    I have set that when a member signs in, that it automatically redirects them to their profile page, I am just wondering if there is away to insert/add a profile button to the navigation. The reason for this is simply if a user leaves their profile page and goes to another web they only way the can go back to the profile is using the back button on the browser or going to the members page and selecting their name.

    I hope someone can help.

    Thank You

Viewing 15 replies - 1 through 15 (of 15 total)
  • @sbrajesh

    Participant

    Put this in your functions.php.
    `
    add_action(“bp_nav_items”,”show_user_link”);
    function show_user_link(){
    if(!is_user_logged_in())
    return;
    ?>
    <a href="”>MY Profile
    <?php

    }
    That should do it.

    Edit: Please DO NOT USE THE CODE above, this forum has eaten the code, so that’s not going to work. Please see my post blow with the pestabin link.

    I couldn’t get this to work either….but it’s a potentially very useful addition to the nav bar. The current navigation to your own profile isn’t very intuitive.

    @sbrajesh

    Participant

    hi
    sorry for delayed reply.
    You can put it in your theme or just create bp-custom.php in your wp-content/plugins and put the above code.
    I am posting it on pastebin for you(the forum post ate my code ).
    http://bpdev.pastebin.com/FSm7VQ2L

    It will work if you are using the buddypress default theme or a theme which supports buddypress standard theme action.
    Please let us know if you are using bp-default or not.

    Thanks
    Brajesh

    @sbrajesh

    Participant

    ok, I guess, you are using li in the navigation.
    here is the modified code with li
    http://bpdev.pastebin.com/sujjHemJ
    Also, you may edit the html part to match the struture of your navigation

    Hi Brajesh! The code you first posted does the job with the BP default theme, and puts the link in the right place. What it doesn’t do is pick up the styling of the rest of the nav bar buttons – it just creates a link. How do I get it to do that? (Apologies for my lack of technical ability, but I’m learning as I go….)

    @sbrajesh

    Participant

    @gtn
    Hi, Please take a look at the second code, It will allow you linking while retaining the buddypress style. I had forgot to put the li elements, so, corrected in the 2nd link.
    Hope that helps.
    Thanks
    Brajesh

    @richard1987

    Member

    Hi Brajesh

    Thanks for this piece of code, Ive been looking for something like this for awhile now. One problem however (nothing to do with your code tho).

    When a user logs into my BuddyPress website it automatically redirects them to their profile page, therefore making the MEMBERS and MY PROFILE link both active, (In my case they are both now turning orange). Is it possible to make only the MY PROFILE link active?

    Hope i have explain my problem ok?

    Thanks

    @sbrajesh

    Participant

    @richard1987 @sofastop you are most welcome:)
    For no highlighting the members tab and just highlighting the “My profile” tab, we will need to modify the header.php.
    Please create a child theme and copy the header from bp-default to your child theme.
    Then edit it and change line no 57 where the code says

    to

    Edit: Seems the code did not pass. Posting on pastebin again
    http://bpdev.pastebin.com/GCxK3i0y

    I hope, the code passes through the forum.

    @sbrajesh

    Participant

    hey no problem :)
    Have you already created a child theme, if yes, just create header.php and put the following code in your child theme’s header.php
    http://bpdev.pastebin.com/PMiZRcZN

    Then activate your child theme and everything should work.
    let me know if it works or not.

    @sbrajesh

    Participant

    hi
    I have modified your code.
    http://bpdev.pastebin.com/tFENajNf
    Just copy it back to your header.php and should work.

    @sofastop

    Member

    Brajesh, I am getting the following problem on line 71

    Parse error: syntax error, unexpected T_BOOLEAN_AND in /home/sofastop/public_html/wp-content/themes/sofastop/header.php on line 71

    @sbrajesh

    Participant

    hey Sorry, there was an extra “)” left on line 71. Modified again
    http://bpdev.pastebin.com/itL0UMP6

    @sofastop

    Member

    Thank you! Sorted, appreciate the help!

    @sofastop

    Member

    Hi Brajesh, see the profile link, it appears at the end of the navigation bar – how do i move it to the beginning?

    Hi Brajesh,

    Apologies, but I’m now lost as to what I should be putting in a bp-custom.php file to work with the default BuddyPress theme to provide a link with a matching navigation button. I’ve tried various elements of cutting and pasting from what you’ve posted, and always end up with errors. (This is probably because I don’t really know enough – plugins were made for the likes of me!)

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Adding a Profile Button to Navigation’ is closed to new replies.
Skip to toolbar