Home > Software engineering >  Buddypress single profile page show 404 error
Buddypress single profile page show 404 error

Time:05-22

I just put this code to get user id.

<a href="<?php echo bp_get_member_user_id() ?>" target="_blank"
> >View Profile</a>

Now it's show the permalink as user id.

localhost/demo/members/5

But when I click view profile it's show 404.

How to solve this problem?

CodePudding user response:

the function bp_get_member_user_id only return an integer (the userid)

in case your target is localhost/demo/members/5, try to use this code:

<a href="/demo/members/<?php echo bp_get_member_user_id(); ?>" target="_blank"
> >View Profile</a>

CodePudding user response:

BuddyPress uses the user_name in a profile url. Unless you made changes to that functionality, an integer won't work. Try:

<a href="<?php echo bp_core_get_user_domain( bp_get_member_user_id() ); ?>" target="_blank"> >View Profile</a>
  • Related