开发者

Joomla Login redirection back to page to the previous page

开发者 https://www.devze.com 2023-02-20 18:34 出处:网络
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. O开发者_开发百科nce they login, I want to redi

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. O开发者_开发百科nce 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.


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'));  


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

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


[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.

0

精彩评论

暂无评论...
验证码 换一张
取 消