I have a content type that I want to have certain fields show up for different users. For instance, for admin, I'd like the users to see all of the fields available, however, for non admins, I'd like to have one certain fields displayed. Is this possible?

Field visibility & access can be controlled with the Field Permissions module.

Yes Field Permission is best choice. If you don't want to go with Field Permission module then below is another option. function hook_form_alter(&$form, &$form_state, $form_id) {

if($form_id == 'form_id') {
  global $user;

 //  print_r($user->roles);
 // Check to see if $user has does not have the administrator role.

  if (!in_array('anonymous user', array_values($user->roles))) {
    $form['field_your_field']['#access'] = FALSE;



You may make two templates for that, one for admin user and second for non-admin user. In your custom templates you can show up fields according to your own will. For more details about template suggestion check drupal docs.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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