It’s likely the stuff after the /???????/ which is the issue then.
Try /members/me/ to see if that gets you to the profile.
If yes, then you can experiment with removing /profile/ and other combinations.
Hi @rayray23,
Since nobody seems to be replying to this … I’m definitely no expert, but I think it’s possible you might want something like:
if (is_user_logged_in()) {
$user = wp_get_current_user();
$username = $user->user_login;
I personally find it hard to search the WP documentation, but there should be information in:
https://developer.wordpress.org/reference/functions
Hope that’s helpful,
Mike
Mike,
Thank you for responding. I appreciate the effort!! I am trying to create a button that redirects the user to a specific part of their profile. I do not necessarily want a function but a variable that inserts the user’s name into the link.
In the past I have used this:
https://thornbladehills.com/members/[variable]username[/variable]/profile/
I added the ending: edit/group/1/
and at one time it worked great.
Combined it use to look like this:
https://thornbladehills.com/members/[variable]username[/variable]/profile/edit/group/1/
The code replaced the variable text with the user’s username and looked like this:
https://thornbladehills.com/members/ppp5555/profile/edit/group/1/
which would take the user to their profile page and also to the section to edit group 1
Group 1 is the user’s base information they filled out at registration.
The code works with the user not being logged in. I just have to manually replace the username and then it goes directly to the section I want it to go to.
Possibly because of security reasons, buddypress may have taken the variable text out of use, but like I said it still works if I manually enter the user’s username.
Thanks
Raymond
rayray,
What happens when you are logged in to your site and you put this in the address bar …
yoursite/members/me
Nothing?
What happens?