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.
Problem/Motivation
When using IP Geolocation Views & Maps to determine a visitors current location via the views proximity filter, I am getting the following JavaScript error:
Google Maps API warning: RetiredVersion https://developers.google.com/maps/documentation/javascript/error-messages#retired-version"
The version is currently hard-coded in the ip_geoloc_build_google_api_url() function.
Proposed resolution
For a quick fix, the version number can simply be increased to the current version: 3.27. For a more robust solution, the version should be configurable via the settings page.
Remaining tasks
- Write patch for quick fix, review and commit
- Discuss a configurable solution, write patch, review and commit
User interface changes
Possible new setting on the settings page.
Comment | File | Size | Author |
---|---|---|---|
#10 | ip_geoloc-google-version-quick-fix-2886283-9.patch | 464 bytes | Spokje |
Comments
Comment #2
jantoine CreditAttribution: jantoine as a volunteer commentedQuick fix patch attached.
Comment #3
RdeBoerComment #4
RobLoachComment #5
Chris Charlton+1 for the quick patch.
Nowadays v3.8 is the current [stable] "release." v3.7 is "frozen", and v3.9 is the current "experimental". So this version string train will need to keep moving.
Note: Omitting the minor version number will always use Google's stable version, if you don't want to keep changing version strings.
Comment #6
Joel MMCC CreditAttribution: Joel MMCC commentedWith what @Chris Charlton said in #5, I recommend altering the patch as follows:
The comment I added should probably be amended or removed. That was for clarification here only.
I just did this manually and it works fine. The RetiredVersion warning error no longer appears in Developer Tools Console.
Comment #7
Chris Charlton+1 for this recent suggestion/change as a stopgap.
Comment #8
SpokjeAt the time of writing this the current version of Google Maps API is at 3.30
Added patch with @JoelCC's code from #6
Comment #10
SpokjeGrmbl, wrong patch format...
Retry
Comment #11
SpokjeComment #12
Joel MMCC CreditAttribution: Joel MMCC commentedThanks, @Spokje!
Comment #13
drupalgin CreditAttribution: drupalgin as a volunteer commentedComment #14
Chris Charlton+1 to this change!
Comment #15
pjeutr CreditAttribution: pjeutr commentedWould be great if this was also patched on stable 1.31?
I can't imagine this breaking anything and it is a huge leap forward keeping google satisfied!
Comment #16
fractile81 CreditAttribution: fractile81 at Miles commentedConfirming that the patch in #10 applies to the latest release and gets rid of the JavaScript error.
Comment #17
Chris CharltonTests pass. RTBC by multiple people. Let's do this! :)
Comment #18
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commentedConfirmed here also we should roll this into the dev at least
Comment #19
sumachaa CreditAttribution: sumachaa at TATA Consultancy Services for TATA Consultancy Services commentedAdding an updated patch with uses a variable to define the version
It defaults to 3
Comment #21
Joel MMCC CreditAttribution: Joel MMCC commented@sumachaa #19, I would recommend against allowing direct input of the API version number, or at least the whole thing. The integer part should be hard-coded to “3”, period. While I can maybe see a reason why the decimal part could be configurable, it should only be done if some add-on module that interfaces with ip_geoloc depends on some quirk of an earlier version. But then again, Google is just going to retire and disable that older version anyway, which is why this Issue even exists, so even then I don’t really see the point. It just gives site admins another easy way to accidentally break key site functionality, and for no gain that I can see.
If and when Google comes out with a Maps/Geolocation API v4, it’d be a major change that would very likely break ip_geoloc and other Drupal modules that use the Google APIs, so allowing configuration of the integer part is just asking for trouble, Google would likely keep the v3 API up for awhile in a deprecated-but-not-retired status, to allow time for coders of modules and such to transition over to v4 (I believe they did that with the v1–v2 and v2–v3 transitions).
If you do allow configuration of the decimal portion, it should query Google for the minimum non-retired version and not allow the input to be less than that, nor greater than the most recent available stable (or maybe beta — allowing beta versions could be a checkbox-set boolean variable) v3.x version, and perhaps have a cron task that re-queries Google every day or week or so and increments the setting automatically if the configured one gets retired. The decimal input should allow entry of only one to three digits, and if not empty, the version string should be formed by appending a U.S. decimal point (period) and the contents of that field to the hard-coded “3” to form the final version number.
Again, though, I really don’t see the point. Specifying just the decimal part / major API version number solves the issue and has no downsides that I can see. Doing this in an “idiot-proof” (no such thing, of course) way that would make it as unlikely as feasible for a site admin to accidentally break his site with this setting would be a lot of work for no appreciable even potential gain that I can see. If you know of even a potential realistic use case, I’m willing to be proven wrong on this.
Comment #22
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commentedI think that the point of inputting the value is valid. I could see issues where people assume things should work by adding v4 and they don't. I would //really// love to actually get this issue closed and the patch that I submitted ported. I mean this is live for over a year now, and at this point people shouldn't have to drop in a patch to make things move :/
Comment #23
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commentedI also agree to the manual modification this wasn't the initial intention so I'll revert it back to the previous. Please pretty please can this get committed.
Comment #24
ShaneOnABike CreditAttribution: ShaneOnABike at Bees on a Bike commented