Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Creating a link to the member page


Greg
Participant

@rebootnow

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;

Skip to toolbar