Kunena 6.2.6 released
The Kunena team has announce the arrival of Kunena 6.2.6 [K 6.2.6] which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1 / K 6.2 and issues discovered during the last development stages of K 6.2
Question Where to add,change redirect url after login?
- LittleJohn
- Offline
- Kunena Contributor
Please Log in or Create an account to join the conversation.
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;
$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 ; // registerlink : we dont want it to redirect
$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
Please Log in or Create an account to join the conversation.
BUT
When i go to mysite.com/forum and use the log in from there, which by default is located in top forum. After I press log in it will redirect me to mysite.com/index.php instead of stying at mysite.com/forum ???
You know what I mean? My question was how do i redirect this to the forum url?
Thank you
fxstein wrote:
anglis wrote:
Hi,
I can't find where can i change url after i have logged in, for example, it redirects as default to my main page of the web site, I simply want to see my forum after i log in, coz it does look confusing in my situation.
I am using the newest Kunena forum version!
Cheers
anglis
Hi,
such a redirect is controlled by the login module. Whatever module you use is responsible for that. In out case kunena.com is running jomsocial and we set jomsocial's login redirect to the forum home page.
You won't find a setting inside of Kunena for this as we are just the component that get redirected to, but we are currently not in control of the login and what comes next.
Hope this helps!
fxstein
Please Log in or Create an account to join the conversation.
So my solution is for that purpose. Just modify as below:
//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;
//Comment out/delete 1 line:
//$loginlink = JRoute::_('index.php?option=com_user&view=login');
If you are using joomsocial, add the above modification below these lines:
else if ($fbConfig->fb_profile == 'jomsocial')
{
}
Best regards,
Bao Nguyen
Please Log in or Create an account to join the conversation.
anglis wrote:
Hi,
such a redirect is controlled by the login module. Whatever module you use is responsible for that. In out case kunena.com is running jomsocial and we set jomsocial's login redirect to the forum home page.
You won't find a setting inside of Kunena for this as we are just the component that get redirected to, but we are currently not in control of the login and what comes next.
Hope this helps!
fxstein
Hi fxstein,
It's true that kunena is using Joomla login component, but the sweet thing is we can control how it will redirect after successfully logon/logoff/resetpassword...
Just append "&return=destination-url-that-you-want-to-redirect-Encoded-by-base64" when calling joomla login component.
Please Log in or Create an account to join the conversation.
URL: forum.baonguyen.vn
I modified source code of kunena to have this direction function works.
Cheers,
Bao Nguyen.
Please Log in or Create an account to join the conversation.
Hi Bao!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;
$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 ; // registerlink : we dont want it to redirect
$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
I'd just like to add that the base64 lines also aren't part of the regular profilebox.php so the edit start lines are also
//Mod start
$redirectUrl = $_SERVER;
$redirectUrl = base64_encode($redirectUrl);
$redirectUrl = '&return='.$redirectUrl;
...
and then the rest.
P.S.
Your redirect works fine and u can basically use this to redirect login to anywhere on the site.
Cheers m8!
It's a joke! It's a f***ing joke!! What's the matter with You!!??
Please Log in or Create an account to join the conversation.
tried your solution, worked well on login, not working for register.
To make it work for register the Joomla com_user component needs update for the view "register" to regard return parameter in the same way as "login" view does.
I'll get back with code changes if I decide to make them.
Please Log in or Create an account to join the conversation.
1. In com_user\views\register\view.html.php
insert these lines somewhere before last line of code (parent::display($tpl):
// Get the return URL
if (!$url = JRequest::getVar('return', '', 'method', 'base64')) {
$url = base64_encode($params->get($type));
}
$this->assign('return', $url);
2. In com_user\views\register\tmpl\default.php add following line before last line of code (<?php echo JHTML::_( 'form.token' ); ?>):
<input type="hidden" name="return" value="<?php echo $this->return; ?>" />
3. In com_user\controller.php in method register_save() replace last line of code ($this->setRedirect('index.php', $message) with following code:
if ($return = JRequest::getVar('return', '', 'method', 'base64')) {
$return = base64_decode($return);
if (!JURI::isInternal($return)) {
$return = 'index.php';
}
}
$this->setRedirect($return, $message);
Atached zip archive with mentioned modified files.
Please Log in or Create an account to join the conversation.
//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 ; // registerlink : we dont want it to redirect
$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);
}
...
Wouldn't that make a nice-to-have feature in the next version of Kunena?
Please Log in or Create an account to join the conversation.