I wrote a module, which hides some CCK fields for certain USER_ROLES. (It can be set on a content type setting page)

Basically, in nodeapi 'load', it unsets the field: unset($node->$fieldname);

BUT when content_view renders the body and the teaser, it renders the unset field's label, even when the field is not in $node

My patch, skips rendering fields when it is not in $node.
By basically adding an if condition:
if (isset($node->$field['field_name'])) {}{

Do you like this solution? Or how do you think to solve, that some cck field should be set hidden/private.

CommentFileSizeAuthor
#2 cck_field_access.zip997 byteskeve
content_0.patch1.66 KBkeve

Comments

fago’s picture

interesting...
Can I find your module somewhere? Do you share it?

keve’s picture

StatusFileSize
new997 bytes

I have not share it yet, because it is in the beginning stage. But i attach it here. Later i might publish, if the cck developers will not come up with a better idea. :)

fago’s picture

thanks

there is a related issue, which is about permissions for each field. but there's no progress

yched’s picture

Status: Needs work » Closed (duplicate)

Closing this - let's keep this discussion over there http://drupal.org/node/63240