What is the url for the buddypress profile page?

I need to list links to the buddypress features and I have been able to do so for everything except the profile page. How can I get that url to be used as a link - so that if a logged in user were to click on the link it would take them to their buddypress profile page?

My site is http://www.divorcehub.com and their is an "under construction" plugin activated. I have enabled access. Thank you for your help. Linda

  • James Morris

    Hello iempoweru,

    I hope you are well today.

    I believe the following thread will be useful for you in this situation. There's links to code there that shows how to add a custom profile link to your site. https://premium.wpmudev.org/forums/topic/how-to-create-a-dynamic-url-to-buddypress-profile-page

    Let us know if you have any further questions. We'll be happy to help! :slight_smile:

    Best regards,

    James Morris

  • iempoweru

    James Morris - thank you for your quick response. Ok, I saw the buddypress link and my problem is that I don't know what to do with it. There are actually several that lead to the same solution and my same problem.

    Here is what I want to do: create a set of links in the sidebar that when clicked will take the logged in user to their buddypress pages. I have all of them except the profile page.

    So, if I use this: <a href=”<?php echo bp_loggedin_user_domain(); ?>”>Profile</a> as referenced by the buddypress support link that you sent me, where do I put it? It doesn't work in a text widget. And I suspect it has to somewhere else. And if that is the case, where and then how do I call it up in the text widget location?

    Thanks in advance for your help! Linda

  • Luís

    Hi iempoweru ,

    Hope you're doing well today!

    Firstly, sorry for the late reply and all the problems it may have caused.

    The code will not work inside a widget because, by default, you can't run add a PHP code, it will not work. To overcome this you can try:

    1) Install a plugin to create a widget where you can insert PHP, like:

    https://wordpress.org/plugins/php-code-widget/

    2) Create a shortcode in your theme functions.php or via mu-plugin, like:

    function bp_profile_func() {
    
     echo " <a href=".bp_loggedin_user_domain().">Profile</a>";
    
    }
    add_shortcode( 'bp_my_profile', 'bp_profile_func' );

    Then you can insert the shortcode created in your Text widget:

    [bp_my_profile]

    By default, WordPress doesn't allow to insert shortcodes inside the Text widget and you may need to add this code to your theme functions.php to allow it:

    add_filter('widget_text','do_shortcode');

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.