7 months, 3 weeks ago
So after much more hunting around and bit of fiddling, I found a way to do it so I’ll put what I found here for anyone else looking for similar.
So what you need to do is get the current logged in user:
$theCurrentUser = wp_get_current_user();
This creates a variable with an object. Of course we don’t want the object, we want the string part of it. So we get that:
$theCurrentUser = $theCurrentUser->user_login;
We now have the string containing the current logged in user. We can now create the link:
<a href="<?php echo $theCurrentUser; ?> . "/activity/">Activity Page</a>"
I noted when creating this, there is no need to put the first part of the url as this is automatically put in, so it will look similar to:
Hope that makes sense and is helpful to someone!
See also: WordPress.org •
Follow BuddyPress on Twitter •
Contact Us •
Terms of Service