1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing forum language on-the-fly

Discussion in 'XenForo Development Discussions' started by mgl, Mar 11, 2015.

  1. mgl

    mgl Member


    I want to change the forum language whenever there is a specific GET parameter. I've tried something like this:

    public static function Visitor(XenForo_Visitor &$visitor)


    if (@
    $_GET['lang']=="y") {
    XenForo_Helper_Cookie::setCookie('language_id'386400 365);

    But only the initial page changes the language, if I navigate to another page without the GET parameter, the language goes back to default even though I set the language_id cookie. Is there another way of doing this besides setting my own language cookie and checking for it on every request?

    Thank you.
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    Each user has a field to store language. Have you update that?? Look around in the table xf_user
  3. mgl

    mgl Member

    What about non-registered users? Shouldn't the cookie take care of them alone?
  4. Nobita.Kun

    Nobita.Kun Well-Known Member

    No. XenForo did not save Language ID to cookie.
    mgl likes this.

Share This Page