Great module, really finding it useful on one of my current projects, but it would be nice if it would also hide the field lable/title as well as the content.

right now I have a node with a field "phone number" that is set to only be viewable by admins, when anon users look at the page, it does not show the phone number, but it does show a field title (so users see "phone number" with no data)

I'm not sure if this should be submitted as a bug or feature request.

Comments

moshe weitzman’s picture

thats a symptom of removing fields during hook_nodeapi('load'). there is no better to do that in 4.7 without integrating with core cck.i reocmmend upgrading to at earliest opportunity.

arthurf’s picture

Status: Active » Fixed

I think there is a way around this, but it is a bit messy. Since we know the field that is being removed, we can actually figure out what the produced html would be and search and replace it in the $node->body and $node->teaser. For each of the cck fields that need to be removed, we do this:

$remove[] = '<div class="field field-type-'. $remove_field['type'] .' '. $remove_field['class'] .'"><h3 class="field-label">'. $remove_field['name'].'</h3>';

and then do a search and replace. I took a stab at doing this, and in the latest cvs in the 4.7 branch, this is supported. I'm not sure that it is working 100% yet but it did work for a few tests for me. Please let me know if you encounter errors with this- particularly the information about the cck content type will be important, and if you're handy with regex, that would be a saving grace because my way of doing this is not really the most sustainable.

ericg’s picture

thanks for the idea. I'll give it a try. Most likely I'll just end up making some strange template for the node type and control the display of the field lables from there for now.

arthurf’s picture

Obviously, the template route is the reliable way to go. I did however submit this code into cvs- grab the module here:

http://cvs.drupal.org/viewcvs/drupal/contributions/modules/cck_field_per...

and let me know how that works for you.

ericg’s picture

Perfect! thanks so much. now I can put off the nasty theme work till later. :)

arthurf’s picture

Status: Fixed » Closed (fixed)

closing this issue