0

I have a site with two user profiles (group/single). I have a node type repertoire with a field function which I only need for the profile single (mandatory field). Is there a way to hide this field when a user with profile group is adding a node? I don't want to make two different content types with only one little difference. Thanks in advance!

1

If you want to hide a field from particular role via a contrib module, you can try

http://drupal.org/project/field_permissions

or if you're comfortable in code, see

hook_field_access

e.g:

function mymodule_field_access($op, $field, $entity_type, $entity, $account) {
  if ($field['field_name'] == 'field_of_interest' && $op == 'edit') {
    // TODO: some special access check for TRUE or FALSE in $access
    return $access;
  }
  return FALSE; // default deny
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.