When the new user gets saved to the database, the timezone is saved in a format inconsistent with Drupal 7.
In Drupal 6 the timezone is stored as an offset from GMT in seconds whereas in Drupal 7 the timezone is stored in PHP timezones as detailed here.
It is currently defined as the following:
$user->user_timezone = $user->user_timezone * 60 * 60; # Drupal stores timezones in seconds
In the update from D6 to D7 user_update_7002 is what alters the timezone from an offset to a 'friendly timezone' so perhaps parts of that could be implemented, although that just sets it to NULL.
Another usecase could be to use http://php.net/manual/en/function.timezone-name-from-abbr.php for example:
$second_offset = $user->user_timezone * 60 * 60;
$user->user_timezone = timezone_name_from_abbr("", $second_offset, 0);
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | save_timezones_correctly-1805344-2.patch | 868 bytes | adammalone |
| #1 | save_timezones_correctly-1805344-1.patch | 869 bytes | adammalone |
Comments
Comment #1
adammaloneI've not tested this out to see if it works as I don't have a PHPBB database to draw from anymore. I just noticed this issue after cleaning up an old migration as some users couldn't log in as it would white screen when the user tried to log in.
Patch attached, check it out and see if it works!
Comment #2
adammaloneI've just rerolled without the whitespace I noticed in there.
Comment #3
JeremyFrench commentedPatch works nicely. Thanks!