In my user-profile.tpl.php file I'm not using the $content variable, but instead printing each profile variable individually like so:

<?php if ($account->profile_phone_number != '') { ?>
<dt>Phone number</dt><dd><?php print t('%phone', array('%phone' => $account->profile_phone_number)); ?></dd>
<?php } ?>

I'm guessing because the php is only asking if the field is also private before it prints?

Is this the case, how would I add check to see if it's private?

Thanks!!

Comments

quicksketch’s picture

Profile Privacy actually takes a somewhat odd approach in preventing profile module from printing certain data. Because there's no check in profile module to check for privacy, Profile Privacy actually *deletes* any private data before profile module renders the fields. Profile module then just assumes the user didn't enter a value and doesn't print anything.

So for your theming, you shouldn't need to do any additional work since any private fields will be removed entirely already. You can also check $account->private_[name_of_field] though, which will be set to TRUE if that particular field has been marked private.

quicksketch’s picture

Also... in your testing you might notice that all the fields always seem to be showing up. If you have "administer users" privilege (user #1 will always have this permission), no data will be hidden.

unxposed’s picture

Ahhhh, #2 was the issue : ) silly me!

Good to know how it all works though, thanks for taking the time to respond!

quicksketch’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.