How to hide a field by role? i have the CCK Perm but i dont know how to hide it using the contemplate.
I have the same problem, I wanna hide a cck field to anonymous users....
Some response?
thank's
Anonymous users have ID of 0 so the following returns false and hides content.
global $user; if ($user->uid){
[the bit you want to hide] };
};
global $user; if (in_array('name of role', $user->roles)) { print $node->field_my_field['view']; }
Untested code off the top of my head, but you get the general gist.
Comments
Comment #1
polmaresma commentedI have the same problem, I wanna hide a cck field to anonymous users....
Some response?
thank's
Comment #2
realityloop commentedAnonymous users have ID of 0 so the following returns false and hides content.
[the bit you want to hide]
};Comment #3
jjeff commentedUntested code off the top of my head, but you get the general gist.