GeoIp

How to override a region/state name?

1 year 4 days ago #74749

Dan Oldermount's Avatar Dan Oldermount

When I get the region/state of a user in Mexico City, this code

$location = $geo->get(array('region'));
echo isset($location->region)
results in "Mexico City".

But on backend, when assigning the region/state for a module it shows as "Distrito Federal".

On frontend, the module doesn't show up at all. Other regions/states work pretty well, all but this one it seems.

Mexico City actually is Distrito Federal; but I'm guessing that these names aren't been well matched through the plugin.

BTW, I now know that the mmdb file can't or shouldn't be edited.

Please advise.

1 year 4 days ago #74750

Peter van Westen's Avatar Peter van Westen Admin

What Region Code(s) do you see on this url:

https://www.regularlabs.com/geoip.php
Or to test a specific IP address:
https://www.regularlabs.com/geoip.php?ip=123.123.123.123

The "Distrito Federal" uses Region Code MX-DIF.

1 year 3 days ago #74758

Dan Oldermount's Avatar Dan Oldermount

When following your url, i get region code: NLE and region/state Nuevo León; both on wif-fi or cellular data. That is my location.

On the website, when on wi-fi, I also get NLE; cool.

On my phone using cellular data (no wi-fi) I get region code CMX and region/state Mexico City.

Two questions:
1. Do I need a https ssl certificate to show the correct region code for my location when using cell data?
2. Is there a chance that CMX is not matching MX-DIF somewhere..? Re:

The "Distrito Federal" uses Region Code MX-DIF.
Because I don't get the module to show up when region is CMX/Mexico City, formerly known as Distrito Federal.

Thanks for your support!

1 year 3 days ago #74760

Peter van Westen's Avatar Peter van Westen Admin

Please try the latest development version from:
www.regularlabs.com/development-releases

This should fix the issue with locations returning 'CMX' as the Region Code.

Regarding what your phone returns as the location is down to your phone network provider.
There is not much you or I can do about that.
Like it says in the documentation, GeoLocation is not 100% watertight.