I understand that <?php bp_get_nav() ?> gets all the links and displays them, but if I wanted to display one at a time and link them off an icon, how would I do that?
Well, I don’t see any bp template tags that get those specific things. However, for all members in bp the urls are the same. Example:
member profile : http://yourdomainhere.org/members/username/profile
Substitue in code ‘yourdomainhere.org’ with your domain name and ‘username’ with a valid user’s username.
Same scheme for all the other things you want to get to like the member’s wire.
http://yourdomainhere.org/members/username/wire
Take a look at the urls in the member adminbar under ‘my account’. Just hover on down the list and you’ll see the urls for each bit-and-piece in firefox at the bottom left of the window.
What I did was added this code to my theme’s functions.php file:
<?php function _user_name()
{
global $userdata;
get_currentuserinfo();
echo $userdata->user_login;
}
?>
Then, you construct your links like this:
http://yourdomainhere.org/members/<?php _user_name(); ?>/profile
Just swap out “profile” for whatever you want to link to.
Best way is to do it like this (for the logged in user):
----
echo $bp['loggedin_domain'] . $bp['profile']['slug'];
echo $bp['loggedin_domain'] . $bp['messages']['slug'];
echo $bp['loggedin_domain'] . $bp['friends']['slug'];
echo $bp['loggedin_domain'] . $bp['groups']['slug'];
echo $bp['loggedin_domain'] . $bp['wire']['slug'];
echo $bp['loggedin_domain'] . $bp['activity']['slug'];
----
If you put that code inside a function, make sure you global $bp;
at the top.
Does Andy’s approach still apply to BP 1.0?
This is what works for me now:
echo $bp->loggedin_user->domain, $bp->profile->slug;
echo $bp->loggedin_user->domain, $bp->messages->slug;
echo $bp->loggedin_user->domain, $bp->friends->slug;
echo $bp->loggedin_user->domain, $bp->groups->slug;
echo $bp->loggedin_user->domain, $bp->wire->slug;
echo $bp->loggedin_user->domain, $bp->activity->slug;
If this is inside a function, “global $bp;” must be at the top of course.
Does 1.0 have template tags to make this easier?