rajeshatbuzz wrote:I know this topics is discussed many places but could not find proper solution for this.Is there way to redirect same page after successful login?
Wow, looks like Kunena redirect to current page after loggin in is a big issue. I googled and found other posts regarding this issue.
There are some workarounds, but all require lots of modification (some 5+ files or more), which is hard to trace.
So here is my workaround, for Kunena 1.5.9, Joomla 1.5.15:
Edit one file: ccmponents/com_kunena/template/default/plugin/profilebox/profilebox.php, and make it like below:
...
<?php // AFTER LOGIN AREA
if ($fbConfig->fb_profile == 'cb')
{
$loginlink = CKunenaCBProfile::getLoginURL();
$logoutlink = CKunenaCBProfile::getLogoutURL();
$registerlink = CKunenaCBProfile::getRegisterURL();
$lostpasslink = CKunenaCBProfile::getLostPasswordURL();
}
else if ($fbConfig->fb_profile == 'jomsocial')
{
$loginlink = JRoute::_('index.php?option=com_community&view=frontpage');
$logoutlink = JRoute::_('index.php?option=com_community&view=frontpage');
$registerlink = JRoute::_('index.php?option=com_community&view=register');
$lostpasslink = JRoute::_('index.php?option=com_community&view=frontpage');
}
else
{
$redirectUrl = $_SERVER['REQUEST_URI'];
$redirectUrl = base64_encode($redirectUrl);
$redirectUrl = '&return='.$redirectUrl;
//Start of modification
//nttranbao : add "&return=current-page" for Kunena to redirect to current page after log in
$loginlink = 'index.php?option=com_user&view=login' . $redirectUrl;
$logoutlink = 'index.php?option=com_user&view=login' . $redirectUrl;
$registerlink = 'index.php?option=com_user&view=register&Itemid=' . $Itemid . $redirectUrl;
$lostpasslink = 'index.php?option=com_user&view=reset&Itemid=' . $Itemid . $redirectUrl;
$loginlink = JRoute::_($loginlink);
$logoutlink = JRoute::_($logoutlink);
$registerlink = JRoute::_($registerlink);
$lostpasslink = JRoute::_($lostpasslink);
//Comment out/delete these 4 lines:
//$loginlink = JRoute::_('index.php?option=com_user&view=login');
//$logoutlink = JRoute::_('index.php?option=com_user&view=login');
//$registerlink = JRoute::_('index.php?option=com_user&view=register&Itemid=' . $Itemid);
//$lostpasslink = JRoute::_('index.php?option=com_user&view=reset&Itemid=' . $Itemid);
}
...
Save. And try for yourself: go to any page, then click login, enter credentials and bump, you are now at the previous page with logged on status.
PS: you can edit the above links to redirect to whereever you want, after login/logout/register or Lostpassword action
Enjoy
Bao Nguyen