Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

Found it! The point is that your hook_form_alter is called before system_form_alter, so you don't see the timezone. You need to reorder the implementation of hooks with hook_module_implements_alter

Here is the full code:

function CUSTOM_MODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'form_alter') {
    $group = $implementations['CUSTOM_MODULE'];
    unset($implementations['CUSTOM_MODULE']);
    $implementations['CUSTOM_MODULE'] = $group;
  }
}

function CUSTOM_MODULE_form_user_profile_form_alter(&$form, &$form_state) {
  $form['timezone']['#collapsible'] = FALSE;
}

Credits to this postthis post.

Found it! The point is that your hook_form_alter is called before system_form_alter, so you don't see the timezone. You need to reorder the implementation of hooks with hook_module_implements_alter

Here is the full code:

function CUSTOM_MODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'form_alter') {
    $group = $implementations['CUSTOM_MODULE'];
    unset($implementations['CUSTOM_MODULE']);
    $implementations['CUSTOM_MODULE'] = $group;
  }
}

function CUSTOM_MODULE_form_user_profile_form_alter(&$form, &$form_state) {
  $form['timezone']['#collapsible'] = FALSE;
}

Credits to this post.

Found it! The point is that your hook_form_alter is called before system_form_alter, so you don't see the timezone. You need to reorder the implementation of hooks with hook_module_implements_alter

Here is the full code:

function CUSTOM_MODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'form_alter') {
    $group = $implementations['CUSTOM_MODULE'];
    unset($implementations['CUSTOM_MODULE']);
    $implementations['CUSTOM_MODULE'] = $group;
  }
}

function CUSTOM_MODULE_form_user_profile_form_alter(&$form, &$form_state) {
  $form['timezone']['#collapsible'] = FALSE;
}

Credits to this post.

Source Link
Matt
  • 949
  • 7
  • 11

Found it! The point is that your hook_form_alter is called before system_form_alter, so you don't see the timezone. You need to reorder the implementation of hooks with hook_module_implements_alter

Here is the full code:

function CUSTOM_MODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'form_alter') {
    $group = $implementations['CUSTOM_MODULE'];
    unset($implementations['CUSTOM_MODULE']);
    $implementations['CUSTOM_MODULE'] = $group;
  }
}

function CUSTOM_MODULE_form_user_profile_form_alter(&$form, &$form_state) {
  $form['timezone']['#collapsible'] = FALSE;
}

Credits to this post.