Hey sraj49!
I'm not experiencing the same problem that you are having. Do you need to upgrade your Joomla! system to the latest? I made some improvements to our little method however... Maybe this will help. I hope it does!
This is a compilation of work done by iamwaggle, sraj49, and Olaf:
~~~~Login Redirect Hack~~~~
1: create field for the url........For this you need to change the following codes:a) admin/component/com_user/models/user.xml ...add this at the end....
Code:
<param name="url" type="text" default="" label="Front-end Login Redirect" description="URL redirect for a Front-end login" />
<param name="adminurl" type="text" default="" label="Back-end Login Redirect" description="URL redirect for a Back-end login" />
b) admin/components/com_user/models/registered.xml...add this at the end...
Code:
<param name="url" type="text" default="" label="Front-end Login Redirect" description="URL redirect for a Front-end login" />
<param name="adminurl" type="text" default="" label="Back-end Login Redirect" description="URL redirect for a Back-end login" />
2: After this go to components/com_user/controller.php...after line 146???In the login function, change this:
Code:
if(!JError::isError($error)){
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return= 'index.php?option=com_user';
}
To this:
Code:
if(!JError::isError($error))
{
$user =& JFactory::getUser();
$user->getParameters();
if (!$user->getParam('url') == ''){
$return = $user->getParam('url');
}
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return = 'index.php?option=com_user';
}
3: /administrator/components/com_login/admin.login.php... after line 66???In the login function, change this:
Code:
if (!JError::isError($result)) {
$mainframe->redirect('index.php');
}
To this:
Code:
$user =& JFactory::getUser();
$user->getParameters();
$return = $user->getParam('url');
if (!JError::isError($result) && ! $return) {
$mainframe->redirect('index.php');
}else if (!JError::isError($result)) {
$mainframe->redirect($return);
}
Now when you create a user using the User Manager, you can specify the Front-End and Back-end URLs. These can be edited at any time. When you make this change to a user's parameters, the login automatically redirects the user to the specific URL in the user profile.
Many thanks to Raj and Olaf for laying all the groundwork!
~iamwaggle