How to hide a user profile based on custom field? I need to allow users to turn off the public display of their profile if they wish too.  I created a Boolean field to store whether the user wanted the profile shown or hidden.  According to this (old!!) documentation on d.o., I should add an if statement at the beginning of the user profile template. 

Specifically, is this the proper way to access the value?
Edit: Proper, but must account for possibility that value hasn't been set in existing profiles, thanks!

&lt;?php //check to see that user has chosen to show profile
  if(!isset($field_profile_display) || $field_profile_display[0][value] == 1): ?&gt; 


If I put the if statement at the very beginning of user-profile.tpl.php, I see all the fields set to display (with Display Suite), unthemed.  If I put it after , I get a profile page, blank but fo the username as the title.  

Where do I put the code to actually prevent the page from displaying?  Does it need to go in page.tpl?

Generally, is this really still the best practice? Would it be better to implement this in a preprocess hook?
This way is absolutely okay. 
There is definitely the possibility to achieve the same result with the preprocess hook, but doing it in the template file is also a common "drupalish" way and has (as far as i know) no disadvantages. 

One thing:
Do you have already existing users? if so you should check if the variable exists before comparing it with a value... otherwise you could get a php-warning.