Commit 88221c2f authored by Steven Wittens's avatar Steven Wittens

#7646 and more:

- Users who have not edited their account yet would be reset to GMT rather than the sitewide timezone.
- Users who chose GMT (zero timezone) on a site with a non-zero timezone as default would have incorrect timezone.
parent d6a91bdd
......@@ -915,7 +915,12 @@ function format_interval($timestamp, $granularity = 2) {
function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL) {
if ($timezone === NULL) {
global $user;
$timezone = $user->uid ? $user->timezone : variable_get('date_default_timezone', 0);
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) {
$timezone = $user->timezone;
}
else {
$timezone = variable_get('date_default_timezone', 0);
}
}
$timestamp += $timezone;
......
......@@ -106,7 +106,7 @@ function system_user($type, $edit, &$user, $category = NULL) {
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();
$data[] = array('title' => t('Locale settings'), 'data' => form_select(t('Time zone'), 'timezone', isset($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), $zones, t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')), 'weight' => 2);
$data[] = array('title' => t('Locale settings'), 'data' => form_select(t('Time zone'), 'timezone', strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), $zones, t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')), 'weight' => 2);
}
return $data;
}
......
......@@ -106,7 +106,7 @@ function system_user($type, $edit, &$user, $category = NULL) {
if (variable_get('configurable_timezones', 1)) {
$zones = _system_zonelist();
$data[] = array('title' => t('Locale settings'), 'data' => form_select(t('Time zone'), 'timezone', isset($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), $zones, t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')), 'weight' => 2);
$data[] = array('title' => t('Locale settings'), 'data' => form_select(t('Time zone'), 'timezone', strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), $zones, t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.')), 'weight' => 2);
}
return $data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment