Please implement a way to "View anyone's value for field (uneditable)".

That is, rather than hiding the field completely (or not rendering it) in the admin UI I would like a permission that allows content editors to see the field and/or its value yet being unable to edit it.

Whether this is a disabled form field or plain text might need further discussion.

For any administrator it's helpful to have the option of having information at hand even if you can't edit it.

Comments

igalarza’s picture

Suscribe. I would like to have this permission, the field will render on edit page but it will be uneditable.

sheldon rampton’s picture

I have a similar situation where I need to be able to show some fields on the node edit form, but only enable editing of those fields for certain user roles. However, even user roles that cannot edit those fields need to be able to see them while editing. The field_permissions module does not currently support this functionality, but I think it would be a worthwhile enhancement. I realize that adding this functionality could be a bit tricky, but as a possible starting-point, here's some code that I put into a custom "job" module to designate a few fields as read-only:

<?php
/**
 * Implements hook_form_alter().
 */
function job_permission() {
  return array(
    'modify restricted project fields' => array(
      'title' => t('Modify restricted project fields'), 
      'description' => t('Modify the agency name, labor category and assignment number fields on project pages.'),
    ),
  );
}

/**
 * Implements hook_form_alter().
 */
function job_form_job_node_form_alter(&$form, &$form_state, $form_id) {
  if (!user_access('modify restricted project fields')) {
    $form['field_agency_term']['#disabled'] = TRUE;
    $form['field_ogs_labor_category']['#disabled'] = TRUE;
    $form['field_assignment_number']['#disabled'] = TRUE;
  }
}
?>

I think my use case is the sort of functionality that would be appropriate to delegate to a contrib module such as field_permissions. I've filed a comment on an issue ticket there relating to this. However, adding a "view as read-only widget during editing" option to node access definitions in Drupal core would make it easier to do this and also to develop other contrib modules that might have other ways of deciding when to make fields read-only during editing.

Yuri’s picture

I'm also very much in need of such a feature. I tried solution #2 but for some reason that does not work, the fields are still editable in node/add

mordonez’s picture

Status: Active » Closed (duplicate)

Sorry I attached a solution in another issue #1547172: Read only just greyed out

mordonez’s picture

Issue summary: View changes

Re-wrote the entire request for better explanation.

anrikun’s picture

You may try the Field Readonly module.