Joomla Login redirection back to page to the previous page

谁都会走 提交于 2019-12-01 10:38:20

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

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

danidacar

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!