khromov / wp-wpml-geoip-browser-language-redirect

GeoIP Redirector for WPML (WordPress)
GNU General Public License v2.0
46 stars 17 forks source link

Redirect not working: {"country_code":false} #23

Closed ghost closed 6 years ago

ghost commented 7 years ago

hi khromov,

thanks for this great plugin, unfortunately the redirect is not working for me.

When I visit https://www.mysite.com/?wpml_geoip=1, I get:

{"country_code":false}.

I'm in Kenya.

My console returns this when I'm in debug mode:

Uncaught TypeError: Cannot read property 'log' of undefined at HTMLDocument. (browser-redirect-geoip.js?ver=4.8:23) at i (jquery.js?ver=1.12.4:2) at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4:2) at Function.ready (jquery.js?ver=1.12.4:2) at HTMLDocument.K (jquery.js?ver=1.12.4:2) (anonymous) @ browser-redirect-geoip.js?ver=4.8:23 i @ jquery.js?ver=1.12.4:2 fireWith @ jquery.js?ver=1.12.4:2 ready @ jquery.js?ver=1.12.4:2 K @ jquery.js?ver=1.12.4:2

Do you know what could be wrong?

Many thanks! Pieter

khromov commented 7 years ago

@pmjvanwijk Can you try updating your GeoIP.dat file and see if you still get undefined as your country code? You can find a new copy here: https://dev.maxmind.com/geoip/legacy/install/country/

ghost commented 7 years ago

Hi Stanislav, thanks for your reply! Just installed the new version but it stays the same. Our website is https://charlies-travels.com.

On Aug 1, 2017, at 3:02 PM, Stanislav Khromov notifications@github.com wrote:

@pmjvanwijk https://github.com/pmjvanwijk Can you try updating your GeoIP.dat file and see if you still get undefined as your country code? You can find a new copy here: https://dev.maxmind.com/geoip/legacy/install/country/ https://dev.maxmind.com/geoip/legacy/install/country/ — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/23#issuecomment-319350552, or mute the thread https://github.com/notifications/unsubscribe-auth/AIarKeW3uZqzfRkiGcXO4VpGKXD_7NJGks5sTxOvgaJpZM4OpXXq.

khromov commented 7 years ago

@pmjvanwijk Must be some issue with the Maxmind library. Please check your server log for errors. This issue might be related: https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/2

ghost commented 7 years ago

I turned debug mode on and I got this error message: Warning: Invalid argument supplied for foreach() in /www/wp-content/plugins/wp-wpml-geoip-browser-language-redirect-master/WPML_GeoIP_IPResolver.class.php on line 71

This is line 71 in my file: foreach($this->language_mappings as $maxmind_code => $wpml_code)

On Aug 1, 2017, at 3:20 PM, Stanislav Khromov notifications@github.com wrote:

@pmjvanwijk https://github.com/pmjvanwijk Must be some issue with the Maxmind library. Please check your server log for errors. This issue might be related: #2 https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/2 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/23#issuecomment-319354284, or mute the thread https://github.com/notifications/unsubscribe-auth/AIarKfg3nV7-1lRxWcvHqCuoVjbElaYPks5sTxgrgaJpZM4OpXXq.

khromov commented 7 years ago

@pmjvanwijk I know @andreasneuber added an options page for the mappings a while back, did you configure them? :)

Related: https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/20

ghost commented 7 years ago

I’m not sure what you mean but I’ve configured the mappings like this:

$this->language_mappings = array( 'NL' => 'nl', //The Netherlands 'DE' => 'de', //Germany 'KE' => 'nl' //Kenya );

On Aug 1, 2017, at 3:50 PM, Stanislav Khromov notifications@github.com wrote:

@pmjvanwijk https://github.com/pmjvanwijk I know @andreasneuber https://github.com/andreasneuber added an options page for the mappings a while back, did you configure them? :)

Related: #20 https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/20 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/23#issuecomment-319360711, or mute the thread https://github.com/notifications/unsubscribe-auth/AIarKY6cJKqjsblLJdV7OzFUdFpZtDhJks5sTx8igaJpZM4OpXXq.

khromov commented 7 years ago

@pmjvanwijk Mappings are handled through the web UI now. The readme documentation is out of date. See the ticket I linked above. 😄

ghost commented 7 years ago

Thanks! Good to know. I've reinstalled the plugin. I don't see any country codes in the settings menu.

screen shot 2017-08-01 at 4 06 23 pm
khromov commented 7 years ago

@pmjvanwijk Do you have WPML installed and configured for these languages? In that case I'll have to ask @andreasneuber if perhaps the integration needs to be updated.

ghost commented 7 years ago

Yep!

screen shot 2017-08-01 at 4 19 57 pm
khromov commented 7 years ago

@pmjvanwijk Please try with the latest version from GitHub - @andreasneuber added patch to fix this.