Custom module: hide a field

This is another small exercise for you who want to work with module writing. In this exercise you should implement a typical task for a small custom module -- hiding a selected field from non-administrator users. Before starting this exercise you should add a field to an entity of your choice, for example an integer field "points" on user accounts.

There is no suggested solution, but you have these hints:

  • Find the ID of the form you want to alter
  • Check out hook_form_FORM_ID_alter in the Drupal API
  • Check out the global $user variable
  • Check out the #access property for field elements, described in the form API reference