Post the code for wt_get_user_name() here and leave a link http://buddypress.pastebin.com/
This is what i have in my main blog theme that works nicely.. in the wordpress header..
http://buddypress.pastebin.com/m63552cf1
I just want to do the same thing on the buddy press side of things..
the above code doesnt work on the buddy press side.
I have been trying things like..
<?php echo bp_the_site_member_name(); ?>
The idea is to just alow for a quick create group button that takes dynamically adds the users username based on this url..
http://spotskenya.com/spotters/!!!!!username!!!!!/spots/create/
does that make sense??
i realise i may have to define the user name and then echo it but i dont know how to do this..
global $current_user;
$username = $current_user->user_login;
‘http://spotskenya.com/spotters/<?php echo $username; ?>/spots/create/’
Thank you so so so so so much that worked nicely..
Sorry to bring this topic back up, but I am having a similar problem.
I want to add a “Create a Group” button on my Groups page, and to be honest, I’m confused why buddypress wouldn’t put one there to begin with.
So the link I tried (from the code above) is :
href=”members/<?php echo $current_user; ?>/cells/create/”>Create a Group
But where do I put the :
global $current_user;
$username = $current_user->user_login;
part of the code?
Such a button has been added to the default 1.2 theme.
Try this http://buddypress.pastebin.com/m6144dbb0
Hmm, didn’t work, it just took me back to the homepage.
Maybe I’m doing something wrong, I’ll have a look.
I was able to get what I wanted by using the following code. It’s a link and not a button, but it also detects whether the user is logged in and displays a different message if they are not, so you can send them to the sign up page.
<?php if ( !is_user_logged_in() ) : ?>
<p>Don’t see a group you like? < href=”../register”>Login or Sign Up to create a new group.</p>
<?php else : ?>
<p>Don’t see a group that can help you? < href=”../members/<?php global $current_user; get_currentuserinfo(); echo $current_user->user_login; ?>/groups/create/step/group-details”>Create a new group.</p>
<?php endif; ?>
Apparently there’s a get_currentuserinfo() function somewhere that lets you grab info, just like in WordPress. Go figure.
https://codex.wordpress.org/Function_Reference/wp_get_current_user
(Note: I took the “a”s out of the code because this forum is making them into links and the backticks are inexplicably not working)
Thanks for this, though I used bp_loggedinuser_link() instead.