Skip to content

[imp] Multilanguage: allowing any login redirection from login module or login/logout menu items#9724

Merged
roland-d merged 7 commits intojoomla:stagingfrom
infograf768:multilang_login_redirect
May 8, 2016
Merged

[imp] Multilanguage: allowing any login redirection from login module or login/logout menu items#9724
roland-d merged 7 commits intojoomla:stagingfrom
infograf768:multilang_login_redirect

Conversation

@infograf768
Copy link
Copy Markdown
Member

@infograf768 infograf768 commented Apr 4, 2016

Pull Request for Issue #9710 plus some

This PR allows choosing any redirection when login on a multilanguage site.
Before, in the login module as well as in the login or logout menu item, no redirection could be set.
Some redirections were only implemented when there were associations and Automatic change was set using the user preferred site language.
This should still work when no redirection is set.

But now, one can redirect to any menu item in the module without a 404 when the redirection is set to a menu item set to another language than the one displayed with the module, same for the logout menu item. I.e. the user preferred language will be ignored in these cases.
NEW: Except if the chosen menu item is associated to one in the user preferred language. See below.

For the login menu item, we do not use the same field menuitem than the module, i.e. it is a simple text field.

It implies the correct formatting of the url entered for the redirect url in the login menu item: it should always be an internal url and should include &lang=xx-XX in it in non SEF although a SEF url may work but not advised if moving site.

Examples:

  • index.php?option=com_content&view=article&id=151&catid=21&lang=es-ES&Itemid=131
  • index.php?Itemid=136&lang=fr-FR

To test, patch and try all possibilites: with redirections or not, automatic language change set or not.

@infograf768
Copy link
Copy Markdown
Member Author

@infograf768
Copy link
Copy Markdown
Member Author

NEW:
When Automatic Change is set in the language filter plugin, added the association redirect to the user preferred language menu item if the redirection in the login module is set to a menu item associated to that language.

Test:
in the login modules(s), choose a login redirection to any menu item.
(Make sure the said menu item is associated to a menu item in the user preferred language.)
If that menu item is associated to a menu item tagged to the user preferred language, it is that last one that will display after login.

@infograf768
Copy link
Copy Markdown
Member Author

This is incomplete. Have to solve the redirection when login to see an article.

@mannybiker
Copy link
Copy Markdown
Contributor

Hi Jean-Marie, I am testing your code with a specific use case where the redirect is not to an article but to a Menu Item.
I have 2 Menus, one for each language and with 2 Menu items each, like this:

  • Menu - EN
    • Home - EN
      (URL index.php?option=com_content&view=featured&layout=blank&Itemid=810&lang=en)
    • Login - EN (com_users)
      (Redirect URL index.php?option=com_content&view=featured&layout=blank&Itemid=810&lang=en)
  • Menu - IT
    • Home - IT
      (URL index.php?option=com_content&view=featured&layout=blank&Itemid=613&lang=it)
    • Login - IT (com_users)
      (Redirect URL index.php?option=com_content&view=featured&layout=blank&Itemid=613&lang=it)

I then have a user "User" with has it-it as preferred language.

If he lands on the english home of the site and he chooses to login anyway on the english form he will be redirected to the en Home page, despite his preferred language. Don't you think the menu item association should be used too? I think you already do it for login module (line n.575 of languagefilter.php) but not for the login menu.
Hope what I say makes sense.

@infograf768
Copy link
Copy Markdown
Member Author

I am working on this aspect as the only way to get this possibility is to set the url to the menu item in the login menu item as, for example, index.php?Itemid=136&lang=it-IT, where 136 is the menu item id.
See the discussion here: #9826

I already have the code for that by using a supplementary field of the type menuitem and not text. Needs still some tweaking.

But we have a more important issue to solve first: Let's say we have an article set to registered and one has to login to see the full article. Here, It does not return to the article and I have an Error : You are not authorised, etc.

Trying to figure what happens here.

@infograf768
Copy link
Copy Markdown
Member Author

Hmm
#9846

@brianteeman
Copy link
Copy Markdown
Contributor

Possibly related item #7204


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

@infograf768
Copy link
Copy Markdown
Member Author

@mannybiker Please test #10249

Then apply this patch too and choose a menu item in the login menu item redirection.

@infograf768
Copy link
Copy Markdown
Member Author

If #10249 is merged, you can directly test this.
If it is not yet, patch first with #10269

Please test by choosing a menu item (in the Module or/and the Login Menu Item) in a language which is NOT the user preferred language.
Set Automatic Change to Yes in the language filter.

Associate the menu item to another menu item in the preferred default language for the user logging.

Now display the language which is NOT the user preferred language in frontend where the switcher or/and the Login Menu item are displayed.

Log through the module or the login menu item: the user will be redirected to the menu item in his preferred language.

This completes #10249

@mannybiker @MATsxm @brianteeman @andrepereiradasilva

( @mannybiker Now your specific issue should be solved. I.e. By choosing a menu item in the Login menu item and access as guest, you will be able to redirect to another page (with special or public access) than the Login menu item (usually Home page) and if associated, in the user preferred language. )

@infograf768
Copy link
Copy Markdown
Member Author

Hmm, after merging #10249 (or patching it first), we can't apply this to test as it will have conflicts.

@infograf768
Copy link
Copy Markdown
Member Author

Ok, solved. Now both PR can be tested together.

@roland-d
Copy link
Copy Markdown
Contributor

roland-d commented May 7, 2016

@infograf768
Copy link
Copy Markdown
Member Author

#9710 can be closed
#9826 is obsolete. we will provide hints and new tip for the login menu item. will close.

@mannybiker
Copy link
Copy Markdown
Contributor

#9710 confirm can be closed. I will test the new PR from infograf768 very soon

@mannybiker
Copy link
Copy Markdown
Contributor

#9724 tested and working for both menu and module login. My original issue is indeed fixed with this PR and the user preferred language is correctly taken into account when login redirection and associations are correctly configured. Really good job as usual @infograf768 :)

@infograf768
Copy link
Copy Markdown
Member Author

Please mark the test as successful at https://issues.joomla.org/tracker/joomla-cms/9724 :)

@mannybiker
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 34f5bbf

I was wondering how you put this "tested" mark in the comments. Many thanks!! Sorry, I'm still learning all these tools! ;)


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

@alikon
Copy link
Copy Markdown
Contributor

alikon commented May 8, 2016

I have tested this item ✅ successfully on 34f5bbf


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

@brianteeman
Copy link
Copy Markdown
Contributor

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label May 8, 2016
@brianteeman brianteeman added this to the Joomla 3.6.0 milestone May 8, 2016
@roland-d roland-d merged commit 9955e4c into joomla:staging May 8, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label May 8, 2016
@roland-d
Copy link
Copy Markdown
Contributor

roland-d commented May 8, 2016

Merged, thanks everybody.

@infograf768 infograf768 deleted the multilang_login_redirect branch May 29, 2016 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants