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

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

No redirection #4

Closed tazzje closed 9 years ago

tazzje commented 9 years ago

Hi,

I've set up the plugin as follows:

//Array with structure MaxMind Code => WPML Code $this->language_mappings = array( 'US' => 'en', //USA

    );

    //Set the default WPML language which is used if no matching language is found
    $this->default_language = 'nl';

our default webpage is set up via WPML in two languages: dutch (default, for all countries except US - www.domain.com) and English (www.domain.com/en) for US customers. Currently, the redirect is not working. Any ideas?

khromov commented 9 years ago

Hi @tazzje,

You need to add both languages to the array, like this:

$this->language_mappings = array(
    'US' => 'en', 
    'NL' => 'nl'
);

...

$this->default_language = 'nl';

The WPML code was gotten from this post:
http://wpml.org/forums/topic/what-country-codes-are-used-by-wpml-by-default/#post-373616

The redirect is only performed once (it sets a cookie), so open a new incognito window every time you are testing. The goal of this plugin is not to "force" people onto a specific language but to guide them to the proper one, however users are free to change language after that.

Let me know if it works out.

tazzje commented 9 years ago

Hi,

Thanks for the quick response.

Did that, but still no referral up and running… When I visit the website via a US proxy, I still see the regular .com site (not .com/en)

Something else I need to adjust?

Regards, Niels

Op 26 jan. 2015, om 17:36 heeft Stanislav Khromov notifications@github.com het volgende geschreven:

Hi @tazzje https://github.com/tazzje,

You need to add both languages to the array, like this:

$this->language_mappings = array( 'US' => 'en', 'NL' => 'nl' );

...

$this->default_language = 'nl'; The WPML code was gotten from this post:

http://wpml.org/forums/topic/what-country-codes-are-used-by-wpml-by-default/#post-373616 http://wpml.org/forums/topic/what-country-codes-are-used-by-wpml-by-default/#post-373616 The redirect is only performed once (it sets a cookie), so open a new incognito window every time you are testing. The goal of this plugin is not to "force" people onto a specific language but to guide them to the proper page, but they are free to change language after that.

Let me know if it works out.

— Reply to this email directly or view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/4#issuecomment-71490382.

khromov commented 9 years ago

Hej tazzje,

Go ahead and enable debug mode:

var GEOIP_DEBUG = true;

You can change this in the file /js/browser-redirect-geoip.js (change from false to true).

Then, open the javascript console (F12 on Chrome) in an incognito window and visit the root URL of your page. You will see messages in your console. Copy and paste them in this issue, or post a screenshot.

PS. Please make sure you actually have translations for all your pages, otherwise this redirect will not work.

https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/blob/master/js/browser-redirect-geoip.js#L3

tazzje commented 9 years ago

Here you go:

Uncaught browser-redirect-geoip.js:23 TypeError: Cannot read property 'log' of undefined

Op 26 jan. 2015, om 18:57 heeft Stanislav Khromov notifications@github.com het volgende geschreven:

Hej tazzje,

Go ahead and enable debug mode:

var GEOIP_DEBUG = true; You can change this in the file /js/browser-redirect-geoip.js (change from false to true).

Then, open the javascript console (F12 on Chrome) in an incognito window and visit the root URL of your page. You will see messages in your console. Copy and paste them here.

PS. Please make sure you actually have translations for all your pages, otherwise this redirect will not work.

https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/blob/master/js/browser-redirect-geoip.js#L3 https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/blob/master/js/browser-redirect-geoip.js#L3 — Reply to this email directly or view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/4#issuecomment-71505389.

khromov commented 9 years ago

@tazzje Which browser are you using? You need the latest version of Firefox or Chrome.

tazzje commented 9 years ago

Chrome 40.0.2214.91 (64-bit)

Op 27 jan. 2015, om 10:35 heeft Stanislav Khromov notifications@github.com het volgende geschreven:

@tazzje https://github.com/tazzje Which browser are you using? You need the latest version of Firefox or Chrome.

— Reply to this email directly or view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/4#issuecomment-71616228.

khromov commented 9 years ago

@tazzje Something is not right, you will need to get your javascript console properly working:
https://developer.chrome.com/devtools/docs/console

This plugin is not very friendly to non-developers right now, perhaps I will make a better version in the future but right now I am limited in the amount of support that can be provided. If you get the console running, feel free to reply back in this thread.

tazzje commented 9 years ago

Hi Stanislav,

Enabling debug mode disabled our header slider, so we had to turn it off. The console itself is running as it should according to our developers. We recreated the homepage (exact copy) on www.domain.com/test.html http://www.domain.com/test.html and I checked it in console: no errors… but still no redirect when I use this page with a US Proxy to the /en site.

Perhaps you could test it yourself? I can enable debug on the homepage for a few minutes, but not much longer. So if you could let me know when you can take a look on it, I can send you the details (preferably by email) and enable debug.

Op 28 jan. 2015, om 01:27 heeft Stanislav Khromov notifications@github.com het volgende geschreven:

@tazzje https://github.com/tazzje Something is not right, you will need to get your javascript console properly working:

https://developer.chrome.com/devtools/docs/console https://developer.chrome.com/devtools/docs/console This plugin is not very friendly to non-developers right now, perhaps I will make a better version in the future but right now I am limited in the amount of support that can be provided. If you get the console running, feel free to reply back in this thread.

— Reply to this email directly or view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/4#issuecomment-71758427.

khromov commented 9 years ago

@tazzje

Do you mean that setting:

var GEOIP_DEBUG = true;

...made your slider not work? That would normally not be possible, but there may be additional javascript issues on the site.

It's really hard for me to conform to a schedule for this sort of support. If you have a development server where you can enable debug for a few days, feel free to send it over to: stanislav.khromov+ghspam@gmail.com

amaurya37 commented 9 years ago

i am also facing the same problem

tazzje commented 9 years ago

Enabled it again, no errors: sdk.js:61 Invalid App Id: Must be a number or numeric string representing the application id. follow_button.18d1def08d5e73d6896a990fdb4030dd.nl.html:1 Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) player.js:13 'HTMLVideoElement.webkitSupportsFullscreen' is deprecated. Its value is true if the video is loaded.

khromov commented 9 years ago

@tazzje ,

If you have nothing in the log, maybe the plugin did not activate successfully. You'd have to check if the browser-redirect-geoip.js file is enqueued from within the plugin folder.

tazzje commented 9 years ago

Yes, it was executed within 300 ms according to my console.

Op 9 feb. 2015, om 23:02 heeft Stanislav Khromov notifications@github.com het volgende geschreven:

@tazzje https://github.com/tazzje ,

If you have nothing in the log, maybe the plugin did not activate successfully. You'd have to check if the browser-redirect-geoip.js file is enqueued from within the plugin folder.

— Reply to this email directly or view it on GitHub https://github.com/khromov/wp-wpml-geoip-browser-language-redirect/issues/4#issuecomment-73599995.

khromov commented 9 years ago

@tazzje

It is not possible to go further unless you provide full debug logs. Closing this.