function system_user_timezone
system_user_timezone(&$form, &$form_state)
Add the time zone field to the user edit and register forms.
File
- modules/system/system.module, line 2014
- Configuration system that lets administrators modify the workings of the site.
Code
function system_user_timezone(&$form, &$form_state) { global $user; $account = $form['#user']; $form['timezone'] = array( '#type' => 'fieldset', '#title' => t('Locale settings'), '#weight' => 6, '#collapsible' => TRUE, ); $form['timezone']['timezone'] = array( '#type' => 'select', '#title' => t('Time zone'), '#default_value' => isset($account->timezone) ? $account->timezone : ($account->uid == $user->uid ? variable_get('date_default_timezone', '') : ''), '#options' => system_time_zones($account->uid != $user->uid), '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'), ); if (!isset($account->timezone) && $account->uid == $user->uid && empty($form_state['input']['timezone'])) { $form['timezone']['timezone']['#attributes'] = array('class' => array('timezone-detect')); drupal_add_js('misc/timezone.js'); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.module/function/system_user_timezone/7.x