? Failure

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
18 Nov 2016

Pull Request for Issue #12920

When login in a multilingual site, the user should be redirected, if possible, to the associated menu item of the page containing the login module.
If redirections are set (in the login module as well as in a login menu item) they should use the possible associations for the redirect.

Summary of Changes

Using API to get the possible Itemid in order to redirect properly when Automatic Change is set to Yes in the language filter plugin.
Added detailed comments explaining what each situation may obtain.

Testing Instructions

Create a multilingual site from a clean staging. Patch.
Add one more article per language and associate them.
Set the user login preferred site language to another language than the default site language.
Set the language filter plugin to use "Automatic Change"

NOTE: if the user preferred site language is not set, the default site language will be used. Testing does not change. Just replace in the instructions below user preferred site language by site default language.

The following should work when testing, I added the code comments to clarify.

--------------
If login through a login menu item using the Internal URL redirection (on a multilingual site, that url should contain &lang=xx-XX):
// The login menu item form contains an internal URL redirection.
// This will override the automatic change to the user preferred site language.
=> The user will be redirected to that Internal URL, whatever it is.

-------------
If login from a login menu item or a login module and a Menu Item redirection is set
// The login form contains a menu item redirection. Try to get associations from that menu item.
// If any association set to the user preferred site language, redirect to that page.

-------------
// The login form does not contain a Menu Item redirection.
// The active menu item has associations.
// We redirect to the user preferred site language associated page.

-------------
// We are on a Home page, we redirect to the user preferred site language Home page.
I.e. no need to associate the Home pages. They are automatically.

-------------
If Associations are not implemented, Automatic Change set to Yes, no redirection set to a Menu Item and login from another page than the Home page, the user should be redirected to the same page.
If login from a Home page, redirection will be set to the preferred site language Home page of the user.

-------------
If automatic change is set to No, behaviour will be the same as on a monolanguage site.
I.e. redirect to the same page or, if a redirection is set in the login module or login menu item, redirection to that url or menu item.

Documentation Changes Required

None. This broke with the new router because the code was not using the proper API.

avatar infograf768 infograf768 - open - 18 Nov 2016
avatar infograf768 infograf768 - change - 18 Nov 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Nov 2016
Category Front End Plugins
d306211 18 Nov 2016 avatar infograf768 cs
avatar infograf768 infograf768 - change - 18 Nov 2016
Labels Added: ?
avatar infograf768
infograf768 - comment - 19 Nov 2016

Thanks Hannes. Corrected.

Now, when testing this, I found out an issue which is also present in 3.6.4 and was not taken care of.
If a redirection is set in a login menu item (URL or Menu Item), it is that one which is used when we have a "Register to read more ..." instead of redirecting to the full article.

The problem comes from the fact that in both cases, we have the same $active menu item.

Any idea how to solve that one?

avatar infograf768
infograf768 - comment - 20 Nov 2016

Ok. Tested on a monolanguage site and that issue is also present there...
Therefore we can now test this and merge if all OK.

Will create an issue for that problem.

avatar infograf768
infograf768 - comment - 20 Nov 2016

See #12945 for the Read More issue.

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Nov 2016

If login from a login menu item or a login module and a Menu Item redirection is set
// The login form contains a menu item redirection. Try to get associations from that menu item.
// If any association set to the user preferred site language, redirect to that page.

If not, should redirect to the menu item selected?
It's redirecting the user prefered home page.

What is the order of execution priorities here? This?

  • User languagee default page
  • Menu item/login module Menu item Login Redirect
  • Site language default page

Also shouldn't exist a user default login and logout redirect parameters in com_users that would be the "use global" for both the menu item and the login modules? I'm saying this because we have other login form with /component/users/ that doesn't use any of this ...

avatar infograf768
infograf768 - comment - 21 Nov 2016

First, one should consider the default preferred language for the user. It may be also be "default", i.e. the site default language.
Then one should understand that these login redirections are only available when "Automatic Change" is set to Yes. Otherwise the behavior is similar to a monolanguage site.

Login through the module:
Depends first if the active menu item is tagged or not to the user preferred site language (Home or not).

If it is and no redirection is set in the login module, then behavior is similar to a monolanguage site and login redirects to the same page.

If it is not and no redirection is set in the login module, then it looks for an associated menu item in the user preferred language and login redirects to it.

If there is no associated menu item in the site preferred language of the user and login is not done from the Home page, login redirects to the same page.
(Active Home pages menu items are always considered as associated).

If a redirection is set in the login module, then it tries to find an associated menu item in the site preferred language of the user and redirects to it.
If the redirection is already to a menu item tagged to the site preferred language of the user, it simply redirects to it.
If the redirection is to a menu item different than the site preferred language of the user and there is no associated menu item, the user is redirected to the redirection set in the module.

Login through a Login Menu Item
Depends first if the active login menu item is tagged or not to the user preferred site language.

If no redirection is set in the login menu item and it is not associated to a menu item tagged to the site preferred language of the user, the user will be redirected to the user Profile in the language where the login menu item is presented, whatever its preferred site language.

If no redirection but there is an associated menu item tagged to the site preferred language of the user, the redirection will be to that menu item.
If the associated menu item to which the user is redirected is also a login menu item, then it is not the profile which is presented but a Logout button.

If there is a redirection of type Menu Item, behavior is similar to logging from the module when the module has a redirection (see above).

If the redirection set in the login menu item is an Internal URL one. In that case, it is always that redirect which is used, whatever the language.

Also shouldn't exist a user default login and logout redirect parameters in com_users that would be the "use global" for both the menu item and the login modules? I'm saying this because we have other login form with /component/users/ that doesn't use any of this ...

That is totally unrelated to this PR and would be a new feature.

ab0f2d4 24 Nov 2016 avatar infograf768 cs
avatar alikon
alikon - comment - 24 Nov 2016

I have tested this item successfully on ab0f2d4

works as described


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12932.

avatar alikon alikon - test_item - 24 Nov 2016 - Tested successfully
avatar dgt41
dgt41 - comment - 24 Nov 2016

I have tested this item successfully on ab0f2d4


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12932.

avatar dgt41 dgt41 - test_item - 24 Nov 2016 - Tested successfully
avatar dgt41 dgt41 - change - 24 Nov 2016
Status Pending Ready to Commit
avatar dgt41
dgt41 - comment - 24 Nov 2016

RTC

avatar brianteeman brianteeman - change - 24 Nov 2016
Milestone Added:
avatar wilsonge wilsonge - change - 28 Nov 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-11-28 10:55:26
Closed_By wilsonge
avatar wilsonge wilsonge - close - 28 Nov 2016
avatar wilsonge wilsonge - merge - 28 Nov 2016
avatar wilsonge wilsonge - reference | 58145de - 28 Nov 16
avatar wilsonge wilsonge - merge - 28 Nov 2016
avatar wilsonge wilsonge - close - 28 Nov 2016

Add a Comment

Login with GitHub to post a comment