Here is what I do (in BP 1.0.3):
function _profile_url( $login_name=0 ) {
global $bp;
/* if no login name is specified, use logged in user */
if ($login_name) {
$url = $bp->root_domain . '/members/' . $login_name . '/profile';
} else {
$url = $bp->loggedin_user->domain . 'profile';
}
return $url;
}
Wow, hey thank you for responding! So, would I add this to the functions.php and then call it as:
<?php _profile_url(); ?>
Yes. That will give you the profile URL for the currently logged in member. But if all you want is a link to the currently logged in user, then you could use the bp_loggedinuser_link() tag. Note that this returns a LINK (i.e. <a href=”… etc.) and not just a URL. Just put…
<?php bp_loggedinuser_link(); ?>
…in your template where you want the link.
If you do call my _profile_url() above to get the URL for a specific user, then note that you must provide the login name. So it depends what you have to begin with. Let’s say you have the user ID, then you need to get the login name as follows:
$user = get_userdata( $user_id );
$url = _profile_url( $user->user_login );
And while we’re at it, if you want the URL for the displayed user, you can get it using…
global $bp;
return $bp->displayed_user->domain;
@Greg thank you so much. something so simple but so useful when creating our own templates. I dont know if you still participate in these forums but thanks nonetheless.