I am trying to make a field only show up for anonymous users - but the field is visible to authenticated users also. I have set the permissions only to 'anonymous users' in user access permissions.

Is this a known bug? or by design?

Comments

jrglasgow’s picture

Status: Active » Closed (works as designed)

Content Templates don't check user access permissions.

If you want the permissions to be checked you have to code the checking yourself: use the user_access function

if (user_access('some permission from the permissions page')) {
  print $node->title;
} 
else {
  print 'something else, or do nothing';
}

of course replace "some permission from the permissions page" with a permission

plan9’s picture

Great - thanks for the feedback and example code. Will give it a try.