Forum: F.A.Q

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support and general questions related to GEO my WP plugin and its core add-ons please use the support forum.

Language cookie encode decode

Forums F.A.Q Language cookie encode decode

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #34313

    I found this is cityYes undefined problem and added a missing address[x].types in locate.js file :

    if(address[x].types == 'locality,political' || address[x].types == 'postal_town')

    Now the submit is working. I don now if its proper way to do.

    Then, the char encoding problem is related to all the cookies. They are set by javascript and read by PHP/ echoed out, so encoding the protocol doesnt work. My cookie ‘wppl_city’ looks like this for the city of Norrköping :


    Then this causes error retriving correct locations. The locate.js file alerts the proper char from google, but when set the cookie I had to add:

    setCookie("wppl_city", encodeURIComponent(city),7);

    Then in SHORTCODES.php (mark PHP, line 114) I added :

    urldecode($_COOKIE['wppl_' . $display_by]);

    Then The City works. The question is if there is a smoother way to enforce all cookie sets, and php GETs globally.

    Or is there NOT so MANY places to add this fixes ?

    / J


    Not sure. I will have to look it up. But thank you for the tip above. Probably will be a good start point on fixing some of te issues. I just replied to the other post of yours.


    And yes, the cityYes caused the error and the page stopping. I am working on the local.js page. Cleaning it up and removing lot of unnecessary


    Also about the cookies. In my development version I already added the encodeURIComponent into the setcookie function I believe. I am not in front of the computer now. But somewhere in the locale.js there you’ll see the setcookies function so you might be able to modify it with encodeURIComponent so you want have to do it per set cookie call. I remember adding it but I couldn’t verify that it actually works.

    Please ,Let me know if you can modify it and if it works.


    Ok, then it seems to be on the roadmap and the set cookie is only done few places.

    Im gonna check this out and report back. Gonna work tonight. Yes am single….

    Im more worried about the PHP calls, they seem to be called _COOKIE[] directly in each file, not put in to a global scope / array for the logged in user id.

    We will probably remove all cookie anyway and work with sessions for security reasons.

    If the variables is kept withing PHP scope, the language / mobile devices will have less problem with the plugin.

    And in the end we probably build a index for all locations when scaling up the users. But thats another nice problem.



    i cleaned up lot of the code in the locate.js and fixed some of the issue. i took some of your tips above about encoding/decoding the cookies. i removed all the IP address functions for now. I (might but not sure yet )add it back later to let user choose if to turn it on/off.

    Would you go on my site and test it? see if it get your current location and if the issue with the characters/symbols solved?

    thank you


    Gonna check


    The char seems fine!

    There is a leak on auto locate and if entering just the Country, a link seems to spit twice. An email with pictures is sent.

    Göteborg Sverige = Gothenburg, Sweden
    Göteborg = Gothenburg, Sweden
    Sverige = Get your current location (and a break then: .Sweden )

    Then (sometimes) The return value gives Gothenburg,Gothenburg

    The autolocate still wrong values but Correct Chars. I don know if The IP stuff is worked on but just in case I reporting. Autolocate returns:

    Skåne County

    When typing manually it returns Malmö Sweden – correct, Sitting in City of Malmö.

    (The autolocate on the Location Tab returns my apartment!)


    In the future, Is there not a way to combine the 2 and if the first fails, the other (ip) uses. And then, both values can always be overridden by typing manually in the field.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.