It’s a dynamic URL — i.e. it changes for each user, so you can’t just type in a single link in html.
It’s easy to do with a bit of PHP code though — just call the function bp_loggedin_user_domain()
Something like this should work:
`if ( is_user_logged_in() ) {
global $current_user;
$username = $current_user->user_login;
echo ‘ | My Profile‘;
}`
Thankyou so much for your fast reply! Can I just insert this code into a text widget? Or do I need a special plugin?
That did not work for me Toby.
I even added a special PHP widget. Any ideas?
Use the function I provided – there’s no need to try and construct the URL yourself (as Toby has tried).
I am not great with code so my apologies, but how would I do that exactly? I am trying to add a link in the sidebar along with the other community links. Do I need the PHP widget and then add specific code with your “function”? Can you provide the exact code? Sorry again to be a pain. My client is about to give up on it altogether so I just want to try one last time to see if we can get it working.
Thanks so much for your help. I appreciate it.
@rogercoathup is right. Use `bp_loggedin_user_domain()` and not my function.
…note to self, update header code in my theme…
Regarding how and where to add the code, try adding the following to your template:
“
What is the result?
Hi Toby. I am not seeing any code. Maybe you can email it to me? Dawn(at)DPK-GraphicDesign.com. I soooo appreciate your help.
And just a reminder… I need the code to add to the widget to get the link to work under the other links in the sidebar. Thankyou!
I am still looking for help. Anyone?
I am looking for the code to this function as well! I would like to add it as a main menu item. would appreciate any help!
I had no idea that this plugin existed. Thankyou!
@paintermommy did you ever get this to work with the wishlist plugin? Are your forums private and only for paid members?
@mercime, your solution works for my site. However, I’dd like to add the menu as a child menu. Looking at the source code, I know this much information about the parent menu (id=”menu-item-822″). How would I proceed? Please assist.
Thanks.
@bookee is this related to the login link you wanted in other post?
@mercime, thanks for the reply. Yes, this is somewhat related with my request on the other post. In this case, the menu position being the different factor. I appreciate the support, I truly do.
@paintermommy
try this a href="<?php bp_loggedinuser_link() ?>"> profile
To solve this I decided to hijack a page. If the member is logged in, they get their profile, otherwise, they go to a signup page.
Just pop the following code into your functions.php file… and create a page named ‘profile’. Now you can add that page to your WP menu and it should do what you need.
function redirect2profile(){
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if($_SERVER['REQUEST_URI'] == '/profile/' && is_plugin_active('buddypress/bp-loader.php') && is_user_logged_in()){
global $current_user;
wp_redirect( get_bloginfo('url') . '/members/'. $current_user->user_login . '/profile/');
exit();
}
}
add_action('init', 'redirect2profile');