Prevent public to view profile?

5.17K viewsWordPress
0

is there a way to prevent users from viewing the profiles of other users? like questions asked, etc.

1

You can override user template and add below code:

if(!ap_is_my_profile){
    echo "You cannot view this page";
    return;
}

Check docs for overriding AnsPress

Good solution

which folder do we add this code in?

Please refer to documents about overriding AnsPress theme

1

Based on the system of permalink I don’t think that this could be realist. Just because to see a user you’ll simply have to enter his name after /user/ like in this website, my own is http://anspress.io/user/Azman/ and yours is http://anspress.io/user/Neha_Nayak/