• Resolved daveagp

    (@daveagp)


    Hi,

    Polylang rules. But on my website, sometimes we include wp-load.php in order to access wordpress functions from outside of viewable pages. For example, checking wp user authentication from an ajax-based database pull.

    I have a hacky solution on how to make polylang play nice with including wp-load. But is there a way to do it that doesn’t involve changing polylang code? Here’s what I did:

    1. create a new member function for Polylang_Core:

    function set_curlang_by_cookie() {
              $this->curlang = $this->get_preferred_language();
            }

    2. add 2 lines after my old include statement:

    require_once(<path to wp-load.php>);
        $GLOBALS['polylang']->set_curlang_by_cookie();
        $GLOBALS['polylang']->load_textdomains();

    Thanks!!!
    – Dave

    http://wordpress.org/extend/plugins/polylang/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Chouby

    (@chouby)

    Could you try, with the development version of Polylang v0.9, only this part of your code?

    require_once(<path to wp-load.php>);
        $GLOBALS['polylang']->load_textdomains();

    Thread Starter daveagp

    (@daveagp)

    Thanks for the quick reply! and even better – it works!

    We’ve made an interactive website with in-page programming exercises to teach Python, http://cscircles.ca , and your fantastic plugin is letting us put up a French translation with minimal headaches. Thanks again!

    Thread Starter daveagp

    (@daveagp)

    I have some unsolicited feedback too on the new version. I guess it’s development so you may already know about this?
    – the awesome new Languages bar in the top toolbar succeeds in adding lang=fr to the URL’s GET parameters, but this page still appears in English
    – while the admin can change their user account language on their profile page, non-admin users don’t get such an option (although maybe it’s supposed to be superseded by the toolbar selector? which would be ok)

    Thanks/merci again!
    – Dave

    Plugin Author Chouby

    (@chouby)

    Yes feedback is sollicited… http://wordpress.org/support/topic/development-of-polylang-v09

    Maybe it is not clear enough what the language bar is intended for. In current version, you can filter your list of posts by language, just as you can do it by date or by category. I used the same way WordPress does for categories and date to do it. However, the filter works only for posts and pages and is not persistant. With 0.9 and its language bar you can filter your list of posts, pages, media and comments. This filter is persistant. It has also an action on the default language when you start a new post.

    But the language bar has no action on the admin interface language. This is done through the language select option on user profile. However, this has no action on frontend language.

    It’s strange that non-admin users do not get this option. What is the exact role of the user for who it does not work (I tested with ‘contributor’ and it does work).

    Thread Starter daveagp

    (@daveagp)

    Thanks. I now understand what’s going on with the bar. The lack of the contributor options is my own fault: it’s due to some changes I made to the user page a long time ago before I properly understood how to use WordPress.

    Thanks again for the marvelous plugin!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Polylang] Better way to set language from cookie?’ is closed to new replies.