User fields that are visible, but can't be manually edited I have a web service that will be automatically populating certain attributes of a user's profile.

I am creating my fields via field api when the module is installed. I want all of the fields to be visible when editing the user profile, and some of these fields will be visible publicly as well.

My current plan is to form_alter my away around the issue, but I was wondering if someone has an alternate approach they would take.
Between the hooks used from the field API, there is hook_field_access(), which allows to define which users has access to a field when the entity is being viewed, or when the entity is being edited.

function mymodule_field_access($op, $field, $entity_type, $entity, $account) {
  if ($field['field_name'] == 'field_of_interest' &amp;&amp; $op == 'edit') {
    return user_access('edit field of interest', $account);
  }

  return TRUE;
}


There is also a module that uses that hook: Field Permissions.


  The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.
  
  Features
  
  
  Enable field permissions on any entity, not just nodes
  Role-based field permissions allowing different viewing patterned based on what access the user has
  Author-level permissions allow viewing and editing of fields based on who the entity owner is
  Permissions for each field are not enabled by default. Instead, administrators can enable these permissions explicitly for the fields where this feature is needed
  Field permissions overview