How to hide programmatically timezone and location on a custom user edit profile page in Drupal 7? I need a custom user_profile_form in a page of my drupal site containing a subset of fields provided by the form. I created it and rendered it this way:

function mymodule_join_experiment_contr_strict_mode($exp_node, &amp;$form, &amp;$form_state) {
  module_load_include('inc', 'user', 'user.pages');
  global $user;  
  $user = user_load($user-&gt;uid);
  $form = drupal_get_form('user_profile_form', $user, 'account', 'strict_mode'); 
  return $form;
}


Now in my custom function mymodule_form_user_profile_form_alter(&amp;$form, &amp;$form_state, $form_id) i'm doing

$form['picture']['#access']=FALSE;


in order to hide the field 'picture' and any other field i need to hide. In the form i have two collapsible named 'location' and 'timezone', provided, i think, by 'location' or 'gmap' module. (I didn't realized all this site so i don't really know everything about it.)
Now, even looking at $form i can't see the equivalent for timezone and location. I expected to find something that allowed me to do

$form['timezone']['#access']=FALSE;


but i cannot find timezone and location... What i am doing wrong?

EDIT: i'm trying to get what is the right way to do it in drupal, before to surrender and use a 'display:none' on css
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.