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!
<?php //check to see that user has chosen to show profile if(!isset($field_profile_display) || $field_profile_display[value] == 1): ?>
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?