in your users table create a field, something like active_profile, it can be a tinyint(1) and where only gonna store int flags in there representing 1 or 0
now in your users control panel where they edit their stuff you need to add a part for them to enable/disable profile. if they choose to enabled profile then you set the "active_profile" field or whatever u wanna call it to 1, otherwise you set it to 0 to disable it
now all you need to do is go to the script that shows the profile (profile.php for arguments sake). and in there under the query that selects all the users info for display you just put
if($user['active_profile'] == 1)
{
//normal page
}
else
echo "This user has hidden their profile";
very basic way of doing it and doesnt account for allowing buddies to view and staff to view, but its the basics and you should be able to make ur own from their if you can program basic php and understand ur site script to a basic/intermediate level
i aint providing copy and paste code so dont ask 🙂