Hm, interesting. I don’t see many changes on my part (except if your Licence key has a whitespace at the beginning or the end), so I have created a version of the 2.8.0-Plugin with the Maxmind libs that the 2.7.0 had … Can you try it out, please?
https://github.com/yellowtree/wp-geoip-detect/archive/tryOldMaxmindLibs.zip
Thanks Benjamin, I’ll give it a shot!
Hi Benjamin, I just tried this out with no luck. Here’s the code I’m using in my template file:
$allowed = array('US','GB','UK','DE');
if(function_exists('geoip_detect2_get_info_from_current_ip')) {
$userInfo = geoip_detect2_get_info_from_current_ip();
if (!in_array($userInfo->country->isoCode, $allowed)) {
// DO STUFF
}
}
I am not able to reproduce, it is working with my credentials. Can you tell me the symptoms of “not working”, is there an error message? Is it working sometimes, sometimes not?
Sorry for the late reply Benjamin, I’m working on this in my down time at work and since 2.7 is working for us it’s not a super urgent issue. I’m not seeing any errors in the WP dashboard.
I just did another test using version 2.8.2. Version 2.7 adds the correct country code CSS class to the body when I test with the Google Chrome Browsec add on with a location of Singapore. Version 2.8.2 leaves the CSS body class as geoip-country-US geoip-continent-NA when I run the same test.
I also ran the Lookup test in the WP dashboard and that is returning the correct values when running 2.7 but not 2.8.2.
Another difference between the two versions is that 2.7 returns my IP address as 50.196.24.70 (which is correct) but 2.8.2 returns my IP as 172.101.30.218 which is Augusta, Maine.
Maybe the issue has to do with something in the geoip_detect2_get_info_from_current_ip() function?