Any success with Geo Location?

I was looking for a plugin / extra which would work with MaxMind GeoIP2 or GeoLite2 to return a value on user’s supposed country of origin in order to direct to appropriate language content. I couldn’t find anything, nor much discussion - strange, seeing as how common this is over in WordPress land.

Does anyone have any experience or a successful Modx snippet example of using Geo IP database for querying user geo location?

I think, thats because you don’t need much of an Extra and I think, you can just create a snippet, following the examples
maxmind/GeoIP2-php: PHP API for GeoIP2 webservice client and database reader (
after you have downloaded and installed the php api

or just use javascript

Geolocate an IP address using Web Services with the client-side JavaScript | MaxMind Developer Portal

1 Like

Cheers, Bruno, we’ll take a look. JS may be the easier

Had a similar challenge. Easy to do with a snippet. This will show the city based on IP.


        $location = 'unknown';

        $details = json_decode(file_get_contents("{$ip}/json"));


        if( isset($details->city) ){

            $location = $details->city;


You can also check out geocoder, which lets you use different functions from a provider of choice.