Joomla 登录重定向回页面到上一页

2022-01-06 00:00:00 php joomla joomla1.5

我有某些页面需要用户登录 Joomla.当他们点击这些页面的链接时,一个登录框会出现在 iframe 叠加层中.一旦他们登录,我想将他们重定向回他们试图登录的页面,但是,Joomla 似乎只允许用户重定向到登录表单参数中预定义的页面.有没有办法在不完全入侵 Joomla 的情况下做到这一点.

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.

推荐答案

你可以用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'));  

相关文章