Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] A Simple Link To The Users Profile Page


  • mrguythornton
    Member

    @mrguythornton

    Please do not mark this as resolved resolved before reading. I’ve read through all the similar topics to this but have not been able to implement them. I know I’m certainly not alone here. I’m looking for the simplest way possible to add a single link to a logged in users profile to a custom nav bar.

    Since the link is different (unique) for each user I can’t just use the custom menu. I’ve been trying to sort this issue for ages but have had no success. Any help would be very much appreciated.

    The best solution would simply be to add the link to the existing custom menu but I don’t know where to add it. Any ideas please?

    Alternatively, perhaps it would be easier to have no navigation bar and add the link in a static block. Unfortunately, I tried this and it did not work. However, if anyone can make it work, that would do just fine.

    There are a few plugins out there which add a profile link but none work with this theme. The following link also provides some advice but I’ve not been able to get it to work either: http://easyoutsource.com/blog/how-to-code-a-custom-adminbar-in-buddypress/

    Many thanks for any help you can offer.

    Guy

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

  • @ChrisClayton
    Participant

    @chrisclayton

    @mrguythornton – Firstly, the mods are human too and do make mistakes, if they do mark it as resolved when your not confident that it is then just say so and @ one of them asking them to remove it. The mods are actually kind people (unless your a spammer). Also, not sure if your aware of this, but to mark a post as resolved the mods simply edit the title to say so – your welcome to remove it easily by clicking ‘edit topic’ and removing it. (if your the one who started the thread)

    Anyways, now that that’s out of the way – “ is how you would get the URL to the loggedin user’s profile. (you’d have to code it deliberately though, i don’t think it’s easy to add it to WordPress’ custom menu.)

    Something like this will (should?) work.
    `<a href="”>Visit your Awesome Profile!`


    @mercime
    Participant

    @mercime

    @mrguythornton Another way to add profile link to add to what @chrisclayton posted above.

    You can filter wp_nav_menu to include the profile link in custom menu (unless your theme author created his own custom menu for the theme). We add in the requirement for the link to show up only if the user is logged in. The following is added to theme’s functions.php file:

    // Filter wp_nav_menu() to add profile link
    add_filter( 'wp_nav_menu_items', 'my_nav_menu_profile_link' );
    function my_nav_menu_profile_link($items) {
    if (!is_user_logged_in())
    return $items;
    else
    $profilelink = '<li><a href="' . bp_loggedin_user_domain( '/' ) . '">' . __('Visit your Awesome Profile') . '</a></li>';
    $items = $items . $profilelink;
    return $items;
    }

    mrguythornton
    Member

    @mrguythornton

    Dear @mercime and @ChrisClayton,

    I just wanted to thank you both for your advice. I implemented the @mercime method and it worked like an absolute charm. I can’t tell you how long I’ve been trying to do this, so thanks once again.

    Guy


    mrguythornton
    Member

    @mrguythornton

    Dear @mercime, I just have one last question if you don’t mind. Currently the link you suggested is on the right side of the custom navigation bar. Is there any way to move it to the left?


    shanebp
    Moderator

    @shanebp

    try changing
    $items = $items . $profilelink;

    to
    $items = $profilelink . $items;


    mrguythornton
    Member

    @mrguythornton

    Brilliant, works perfectly. Thanks very much @shanebp


    @mercime
    Participant

    @mercime

    @mrguythornton you can mark this issue resolved yourself – click on Edit Topic link under the Topic Title and add [Resolved] before the topic.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] A Simple Link To The Users Profile Page’ is closed to new replies.
Skip to toolbar