joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.3] Fix languagefilter automatic language change redirection when SEF is enabled

Open Flowman opened this issue 6 months ago • 1 comments

Pull Request for Issue #32816 .

Summary of Changes

The language filter is configured for automatic language change and SEF is enabled.

When a logged-out user attempts to access a menu item that requires specific access permissions (e.g., https://test.com/en/somepagewithaccess), they are correctly redirected to the login page. The return URL is set to the intended destination, so the user should be redirected there after a successful login.

However, after signing in, the user is taken back to the login page instead of the originally requested page.

The PR checks if mode_sef is enabled and does the correct redirect.

Testing Instructions

  1. Create a site with 2 languages and SEF enabled.
  2. Create a menu item with access registered.
  3. Enabled automatic language change in Language Filter plugin.
  4. Try to access the restricted menu URL.
  5. Login to the site.

Check the screen capture in the original issue for more info.

Actual result BEFORE applying this Pull Request

User get redirected to the login page when the language filter is configured for automatic language change and SEF is enabled.

Expected result AFTER applying this Pull Request

User get redirected to the correct page when the language filter is configured for automatic language change and SEF is enabled.

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [x] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [x] No documentation changes for manual.joomla.org needed

Flowman avatar Jun 09 '25 11:06 Flowman

I can't get this PR to display default behaviour so have given up on testing it!


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

ceford avatar Jun 10 '25 14:06 ceford

@Flowman I, too, like @ceford have no issues with the BEFORE condition (which for me actually is the AFTER condition) on a Joomla 5.3.2 test site and a 5.3.2 live site - both work as you explain that it should if the PR was applied without the need for the patch.

Is it possible that since 2021, the Joomla Core has fixed this?

Either that or there is a missing step in the Testing Instructions (which do appear pretty clear, easy, thorough), I even tried things beyond your description like setting the Article to a specific language but it still worked fine without the patch.

Looking forward to your reply/thoughts.

exlemor avatar Aug 01 '25 22:08 exlemor

I can confirm the bug. The key to replicating the bug is to make sure that the menu items are associated.

Amended instructions

  • Create a site with 2 languages eg french and english and SEF enabled and a language switcher module
  • Create a french article and a menu item to that article with access registered.
  • Create an english article and a menu item to that article with access registered
  • associate the two menu items
  • Enabled automatic language change in Language Filter plugin.
  • Try to access the restricted menu URL.
  • Login to the site.
  • Log out of the site and using the language switcher module change to the second language
  • Try to access the restricted menu URL.
  • Login to the site.

In the second example you are redirected to the english article on login

brianteeman avatar Aug 02 '25 08:08 brianteeman

I have tested this item :white_check_mark: successfully on 577b3aa81556bc7eaed497a9923d1ed34b65d1f1


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

brianteeman avatar Aug 02 '25 08:08 brianteeman

I have tested this item :white_check_mark: successfully on 577b3aa81556bc7eaed497a9923d1ed34b65d1f1

I have successfully tested this. Thank you @flowman for the PR, and @brianteeman for the updated testing instructions which worked perfectly.


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

exlemor avatar Aug 02 '25 12:08 exlemor

RTC


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

richard67 avatar Aug 02 '25 14:08 richard67

Thanks

rdeutz avatar Aug 05 '25 11:08 rdeutz