Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The user's preferred timezone and language may be retrieved using SREG or AX. We should do that when OpenID is used to create an account.
Especially the timezone is complicated. Auto-detection of timezones only works to some extent. E.g. my timezone is auto-detected to Europe/Paris instead of Europe/Copenhagen (I live in Copenhagen). The two cities belong to the same timezone, so either timezone will work, but some users may get the impression that they have to select the actual city they live in.
Comment | File | Size | Author |
---|---|---|---|
#8 | openid-timezone-language-2.patch | 13.05 KB | c960657 |
#3 | openid-timezone-language-1.patch | 12.51 KB | c960657 |
#2 | openid-sreg-1.patch | 3.03 KB | c960657 |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedAny documentation on how to do that? Is there any chance that the timezone names provided by that means matches ours (which uses the defacto Olsen database)?
Comment #2
c960657 CreditAttribution: c960657 commentedhttp://openid.net/specs/openid-simple-registration-extension-1_0.html
The relevant keys are openid.sreg.language and openid.sreg.timezone. For AX, there is http://axschema.org/pref/language and http://axschema.org/pref/timezone (and probably also corresponding http://schema.openid.net variants).
WRT language codes, the standard refers to ISO639, but AFAICT it does not tell which part of the standard should be used. ISO639 defines both 2-letter and 3-letter codes.
The timezone names are from the Olson database.
Here is an old patch that I wrote last summer (time flies) but never finished. The implementation is now much easier than it was back then because of the recent restructuring of the auto-registration code flow in #395340: Email verification not enforced with OpenID auto-registration.
Comment #3
c960657 CreditAttribution: c960657 commentedUpdated patch. The timezone and language are handled in two different ways because their respective UI is handled by the locale and system modules, and their hook_form_alter()s are invoked on each before and after the openid module, respectively.
Comment #5
c960657 CreditAttribution: c960657 commentedComment #6
c960657 CreditAttribution: c960657 commented#3: openid-timezone-language-1.patch queued for re-testing.
Comment #8
c960657 CreditAttribution: c960657 commentedComment #9
sunLooks good to me.
Comment #10
catchI'm a bit turned around that we have system module implementing user hooks, wtf, not the fault of this patch though.
Patch looks fine to me as well, it's just fixing openid module to work with the spec better, and adds test coverage. Committed/pushed to 8.x.
Comment #11
sun@c960657: Not sure whether this was supposed to be backported - if so, please re-open and tag accordingly, thanks!
Comment #13
Gábor HojtsyThis code got a followup fix in #1527720: OpenID language matching finds least specific instead of most specific match just in case it is considered again for backporting.