skip to Main Content

I just put this code to get user id.

<a href="<?php echo bp_get_member_user_id() ?>" target="_blank"
> class="">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?

2

Answers


  1. 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"
    > class="">View Profile</a>
    
    Login or Signup to reply.
  2. 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"> class="">View Profile</a>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search