How to hide programmatically timezone and location on a custom user edit profile page in Drupal 7?
Solved. I had to use the solution suggested #35

This is the code i used

&lt;?php
function MYMODULE_form_alter(&amp;$form, $form_state, $form_id) {
  if ($form_id == 'MYNODETYPE_node_form') {
    $form['#after_build'][] = 'MYMODULE_SOMETHING_MEANINGFUL';
  }
}

function MYMODULE_SOMETHING_MEANINGFUL($form_element, &amp;$form_state) {
  //note that I only have one location on this node type
  $form_element['locations']['#access']=FALSE;
  $form_element['timezone']['#access']=FALSE;

  return $form_element;
}
?&gt;


I have not quite understood what is going on. An explanation about after_build would be appreciated.