?
avatar infograf768
infograf768
17 Nov 2016

This is working fine in 3.6.4. My feeling is that changes in the router breaks it.

Testing instructions

Create a default multilingual site at installation time, for example with 2 languages French and English.
Set English as default site language.
Set French as default site language for your super user.
Make sure Automatic Language Change is set to Yes in the languagefilter plugin.
Create login module form per language assigned to All pages

Create another article in each language.
Create a new single article menu item to display these new articles per language.
Associate these menu items or associate these articles (or both).
Use legacy router.

###How it is supposed to work
For the moment, do NOT choose a login redirect for the login module.
Also do not create a login menu item with a redirect.

Display the frontend English Home page.
===> When login with the login module, the super user should be redirected to the French Home page.
===> Result: the user says on the same page

Logout and now display the single article menu item in English.
===> When login with the login module, the super user should be redirected to the French associated article.
===> Result: the user stays on the same page.

In BOTH cases the user should be redirected to the French associated page (Home pages are ALWAYS associated de facto) : Home or single article menu item.

Logout.

Now choose in each login module a login redirect to their respective language single article menu item.

Display frontend Home page in English:
Login: ===> Result: the user says on the same page.
Display frontend Home page in French:
Login: ===> Result: the user says on the same page.

The same issue happens when using a login menu item and choosing or not a redirect.

Comments

The issue comes from a change in the value obtained by $this->app->getUserState('users.login.form.return') in https://github.com/joomla/joomla-cms/blob/staging/plugins/system/languagefilter/languagefilter.php#L631 in the onUserLogin() method.

In 3.6.4, we rightfully got for this variable something like index.php?Itemid=104&lang=fr-FR
Then with the regex $itemid = preg_replace('/\D+/', '', $this->app->getUserState('users.login.form.return'));

we got the $itemid, 104 in this case and the user is redirected to the correcty itemid in the correct language.

In 3.7.0 / staging, we get (SEF off):
http://localhost:8888/testinstall/trunkgitnew/index.php?option=com_content&view=article&id=6&Itemid=107&lang=fr
and therefore an $itemid value of 88886107 when we are not on the home page, or 8888 when on the home page instead of null

As can be seen in the onUserLogin() method, the possible case of a Login menu item using an URL and not the Itemid of a menu item is taken care before the check for elseif ($this->app->getUserState('users.login.form.return'))

This is an important regression for a multilingual site,

@Hackwar
@Bakual

avatar infograf768 infograf768 - open - 17 Nov 2016
avatar joomla-cms-bot joomla-cms-bot - change - 17 Nov 2016
Labels Added: ?
avatar infograf768
infograf768 - comment - 17 Nov 2016

Obviously when sef is on, I always get here 8888 as Itemid (I have a port in my local environment), which anyway breaks all.

avatar Bakual
Bakual - comment - 17 Nov 2016

The only place I found where that state is set outside the plugin is in the user controller:
https://github.com/joomla/joomla-cms/blob/staging/components/com_users/controllers/user.php#L100

However there it is set without any JRoute call, so it can't come from there. Except of course if the return value from the POST request (login form) is already a complete internal URL. That's the only case I can imagine where a full url could appear in that userstate.

avatar Hackwar
Hackwar - comment - 17 Nov 2016

I'm wondering why I even care to use the API whereever possible when you seem to always simply take the shortcut (which then breaks). That preg_replace() has to be removed there. If you need the Itemid, take the URL, send it through JUri and retrieve the parameter from there. Otherwise not only ports, but also numbers in folders, etc. will break this.

avatar infograf768
infograf768 - comment - 18 Nov 2016

OK, folks. Got it. Will make PR. Thanks.

avatar brianteeman brianteeman - change - 18 Nov 2016
Category Multilanguage
avatar infograf768
infograf768 - comment - 18 Nov 2016

Please test
#12932

avatar Bakual
Bakual - comment - 18 Nov 2016

Closing as we have a PR

avatar Bakual Bakual - change - 18 Nov 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-11-18 14:31:28
Closed_By Bakual
avatar Bakual Bakual - close - 18 Nov 2016

Add a Comment

Login with GitHub to post a comment