Joomla Login redirection back to page to the previ

2020-03-24 09:07发布

I have certain pages that require to a user to be logged in Joomla. When they click on the links to those pages a login box appears in an iframe overlay. Once they login, I want to redirect them back to the page they were trying to login to, however, Joomla seems to only allow a user to be redirected to a page that is predefined in the login form parameters. Is there a way to do this without completely hacking Joomla.

If not, does anyone have a recommendation on how to hack this an easy way.

3条回答
Ridiculous、
2楼-- · 2020-03-24 09:30

I used $this->setRedirect($link, $msg);

For more information on this function refer here http://docs.joomla.org/API15:JController/setRedirect

查看更多
神经病院院长
3楼-- · 2020-03-24 09:42

You can use like

$return = JURI::getInstance()->toString();
$url    = 'index.php?option=com_user&view=login';
$url   .= '&return='.base64_encode($return);
$this->setRedirect($url, XiText::_('YOU_MUST_LOGIN_FIRST'));  // if you are in controller

or 

JFactory::getApplication()->redirect($url, XiText::_('YOU_MUST_LOGIN_FIRST'));  
查看更多
▲ chillily
4楼-- · 2020-03-24 09:43

[SOLVED] I have solved this issue and implemented in the site. Follow this link, I have written a 5 step tutorial on how to do this.(No Code editing required).

This is how you can do it.

In Hidden Menu

1.Add New menu item : Call it eg. "Login Hidden Menu" . (Users won't see this menu).

2.Add a new menu item name it eg. "User Article upload "to Login hidden menu, Choose Menu Item type : "Create article".(or any other component which only registered users can access. But public can view, Give Access as "Registered" for this Menu.)

In Main menu

1.Goto your Main Menu and create a menu item call it "Submit Article to website".

2.Choose Menu Item type : Menu Item Alias and choose "User Article upload " (you created in Login hidden menu), give access as public.

ALL DONE. Now when visitor clicks on "Submit Article to website" they will be redirected to login page instead of 403 error.

查看更多
登录 后发表回答