Auto-redirect to the login page

Suppose you have a menu item that requires the user to be logged to be able to enter it. Do you want all users to see the link in the menu, and you logged on. If logged in user selects this menu item, pass on the relevant page. If you set the menu item simply an Access Level: Registered – logged on user will see an error page 403, which of course is not advisable.

Auto-redirect to the login page

Conversely, if the user chooses not logged position are:

  • See the page with the login screen.
  • After a successful login to continue the action on which has been redirected.

If he is not registered, has the option to register or go to another page.

Here’s a tip how to achieve this effect in Joomla:

  • Create a new menu, which name such as “Hidden Menu”.
  • DO NOT create the menu for this module – it will not appear on any page, so the module is not needed.
  • Add to this menu, some links that will make available the content or functions only to registered and logged in users. Specify in detail the position of the appropriate level of access.
  • Create a real menu (eg. main menu) and link in the menu, which will be visible to all users.
  • Select the link for this type of menu item called Alias. The parameter “Menu Item” select the link from the “Hidden Menu”. Leave for this link to access the level of General, to make it available to all visitors.
  • Create a module type “mod_mainmenu” for this menu as you create a menu for other modules. If you want to add a submenu, make sure you add the submenu items in the main menu, not hidden in the menu.

Now, when a surfer (unregistered user) selects the menu the link will be redirected to the login page and after successful login you will be moved to the desired page. If it is offline, it will be immediately transferred to the desired page. This works for both the Joomla! 1.5, and the latest edition of Joomla! 1.7.

As described above, the method also has its disadvantages eg. when the position of a hidden menu – registered / special is child position. That’s way you could also use 403 Page Redirect to Account Login method (link) for Joomla! 1.5 .

Auto-redirect to the login page 5.005 (100.00%) 3 votes
This article was first published August 11th, 2011