WordPress.org

Support

Support » Plugins and Hacks » EU Cookie Law Compliance » [Plugin: Cookie Compliance] Polylang compatible?

[Plugin: Cookie Compliance] Polylang compatible?

Viewing 15 replies - 1 through 15 (of 18 total)
  • or wpml? WPML has a nice plugin string discovery and translation tool, but it does not work with your Cookie Compliance

    Plugin Author zafrira

    @zafrira

    Hi RavanH and Tegotha,

    we are working on making the plugin compatible with other language plugins as well.
    We will have a look into the Polylang and WPML plugins.

    Anyone else any suggestions? Please let us know!

    Plugin Author zafrira

    @zafrira

    Hi RavanH,

    release 1.0.8 will be released today, it supports Polylang.
    If you experience any troubles, please let us know.

    That’s great news! I’ll be testing soon 🙂

    OK, first quick test with Polylang shows me the ability to change the texts for each configured language. Great!

    However, it also breaks my home page 🙁

    I use a static homepage with the Showcase template in Twenty Eleven. The Polylang options
    – “When using static front page, redirect the language page (example: http://status301.net/en/) to the front page in the right language”
    – “When the front page is visited, set the language according to the browser preference”
    – “Hide URL language information for default language”
    are checked.

    But after accepting the cookie notice, the home page returns a 404…

    Plugin Author zafrira

    @zafrira

    Hi RavanH,

    an update was released tonight (version 1.0.10), this should fix the problem you experienced.
    Can you check and let me know?

    Thanks!

    It does not seem to change anything. I tried resaving permalink structure and both plugin settings but still the 404 on all language homepages occurs…

    Plugin Author zafrira

    @zafrira

    ok, i will try to reproduce the error. I will let you know when we fixed it for sure 🙂

    Plugin Author zafrira

    @zafrira

    Ok, i could reproduce the error pretty easy.
    Sorry i didnt see this before.

    I added version 1.0.11 but didnt release it yet, could you try it?

    It can be found here: http://downloads.wordpress.org/plugin/cookie-compliance.1.0.11.zip

    Yep, that seems to be working fine 🙂

    Excellent work!

    Maybe I can help a bit…

    But for this, I should understand the reason for you to instantiate a Polylang_Core object on admin side with:

    require_once(PLL_INC.'/core.php');
    $PolyLang = new Polylang_Core();
    require_once(PLL_INC.'/api.php');

    I have seen that you use it only for the function get_current_language which is available only on frontend. Are you doing this for AJAX?

    In that case, setting $_REQUEST[‘pll_load_front’] in your AJAX request should load the frontend side of Polylang, and then you can use the global variable $polylang. If you set $_REQUEST[‘lang’], Polylang will use it to set the language, otherwise it will use the preferred language (cookie or browser preference or default)

    Edit: maybe my help is not needed anymore, if everything works

    Plugin Author zafrira

    @zafrira

    Hi Chouby,

    for the frontend using the pll_current_language('slug') is enough, only need to know the current language.

    But in the backend we need to know the list of available languages. I use the function get_languages_list() for this.

    Indeed the problem was caused by initiating the Polylang_Core object, which was also initiated when on the frontend.

    It does work ok at the moment, but when you see anything that could be improved or simplified. All info is always welcome 🙂

    Plugin Author zafrira

    @zafrira

    Hi RavanH,

    thanks for the check! I will put it in the release now.

    Well, in fact, I don’t understand the lines:

    $tmplang = get_object_vars($PolyLang->get_current_language());
    self::$language = $tmplang['slug'];

    get_current_language has some meaning only on frontend but you call it when is_admin == true (that’s why I thought you are doing this for AJAX).
    Normally, it is not available on backend side (you can call it because you instantiated a “frontend” object of Polylang).

    get_languages_list() is already available on both frontend and backend if you use the global object $polylang

    Plugin Author zafrira

    @zafrira

    ok, that makes sense…

    i kinda just need to set a current or default language code in the backend when there is nothing chosen yet.
    Maybe better if i just take the first language in the list when nothing is set… that should do…
    gonna try that, it would reduce the code indeed…

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: Cookie Compliance] Polylang compatible?’ is closed to new replies.
Skip to toolbar