? cck_field_perms-fix-search-indexing-133113-5.patch Index: cck_field_perms.module =================================================================== RCS file: /cvs/drupal/contributions/modules/cck_field_perms/cck_field_perms.module,v retrieving revision 1.3.2.27 diff -u -p -r1.3.2.27 cck_field_perms.module --- cck_field_perms.module 27 Aug 2007 21:25:36 -0000 1.3.2.27 +++ cck_field_perms.module 28 May 2008 21:47:44 -0000 @@ -72,6 +72,30 @@ function cck_field_perms_nodeapi(&$node, switch ($op) { + // Prevent indexing of disallowed fields. + case 'alter': + $type = $node->type; + if ($types = variable_get('cfp_types', null)) { + if ($types[$type]) { + $disallowed_fields = unserialize(variable_get('cfp_values', null)); + if ($disallowed_fields) { + foreach ($disallowed_fields[$type] as $disallowed_field => $value ) { + if ($value == 0) {continue; } + // This is essentially the same logic as below, but we get rid of + // the content for everyone, not just those without permission. + // We have to do this *here*, rather than in $op 'update index', + // which would be the logical place, because 'update index' can + // only *append* to the returned text, it cannot modify it. + unset($node->$disallowed_field); + unset($node->content[$disallowed_field]); + $node->content['#children'] = drupal_render($node->content); + $node->body = drupal_render($node->content); + } + } + } + } + break; + // prevent viewing of fields case 'view': $type = $node->type;