By jim0203 on
I'm a Drupal developer but I'm having to do some stuff in the theme layer, and could do with a little help.
I want to display different user profiles depending on who is viewing the user profile. My user-profile.tpl.php looks a bit like this:
<?php global $user; ?>
<?php if (custom_function($user) {
print $all_the_usual_profile_stuff;
}
else {
print $some_custom_profile_stuff;
}
?>
My question is pretty simple, really: should this kind of conditional logic go in the .tpl.php? If not, where should it go?
Comments
Well it depends on are you
Well it depends on are you using the core profile module or content profiles?
Do you simply want to differentiate between the person who owns the profile and everyone else or is it more specialized.
Does the output order of the fields change based on who views the profile?
This is the regular profile
This is the regular profile module - and, in fact, my question would still apply to the core Drupal user profiles: user name, email address and password.
I want to be able to control access to user/xx in a fine-grained way. Drupal won't let me do that and user.module won't let me write another module that would let me do that.
So, I need to do it in the theme layer. Is what I suggested - conditional logic in .tpl.php files - acceptable, or should this be done in some kind of preprocess function?