how to restrict access to other users profile links in buddy press?

I have been trying to avoid accessing this specific url which is included under a buddy press plugin profile as :

 http://localhost/members/test0/mycred-history/

I am using an another plugin MyCred for this.The problem which I am facing is that the above link shows the history of points gained by a user..As it is accessable by every logged in user..Merely I want it to be like in this way that only logged in users can check their own history not to be able to check other members profile history page…And it is working under Buddy Press so please..Any help would be appreciated..!

Read More

Simply If I am logged in as “Test1” so I can also check my own follwing link as follows :

http://localhost/members/test1/mycred-history/

And also I can access other members profile history link also :

http://localhost/members/test2/mycred-history/

I simply want to restrict access to one’s own profile history link only..as it’s working as extending plugin namely as MyCrud so it doesn’t have that feature by default while Buddy Press already has this feature by default…
So if anyone can just guide me please how to set it for this history page url so that users can’t access other users profile history url..!
Would be very appreciated..!
Thanks..!

Related posts

1 comment

  1. You’ll need to adjust the code in MyCred that adds the subnav tab for history.
    In that code, add or change to this:

    'user_has_access'   => bp_is_my_profile()
    

    That removes the tab. But they could still access the history screen by using a direct url. So you need to find the template used for the history screen and add a conditional. Something like:

    if( ! bp_is_my_profile() ) 
        echo  'Not allowed';
    else { 
       // code for creating screen content 
    }
    

Comments are closed.