summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module22
1 files changed, 21 insertions, 1 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index fa6b41e28..418a451e5 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -269,7 +269,7 @@ function user_save($account, $array = array(), $category = 'account') {
$values[] = md5($value);
$s[] = "'%s'";
break;
- case 'mode': case 'sort':
+ case 'mode': case 'sort': case 'timezone':
case 'threshold': case 'created': case 'access':
case 'login': case 'status':
$fields[] = $key;
@@ -1360,6 +1360,26 @@ function user_register() {
else {
$form = array_merge($form, $extra);
}
+
+ if (variable_get('configurable_timezones', 1)) {
+ // Override field ID, so we only change timezone on user registration,
+ // and never touch it on user edit pages.
+ $form['timezone'] = array(
+ '#type' => 'hidden',
+ '#default_value' => variable_get('date_default_timezone', NULL),
+ '#id' => 'edit-user-register-timezone',
+ );
+
+ // Add the JavaScript callback to automatically set the timezone.
+ drupal_add_js('
+// Global Killswitch
+if (Drupal.jsEnabled) {
+ $(document).ready(function() {
+ Drupal.setDefaultTimezone();
+ });
+}', 'inline');
+ }
+
$form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 30);
$form['#validate'][] = 'user_register_validate';