User Specific Login Redirect
-
- Joomla! Apprentice
- Posts: 32
- Joined: Mon Jul 06, 2009 8:45 pm
Re: User Specific Login Redirect
Thanks a lot. I have a small issue...When I login to the application through the Home page and when I log out I am not logged out of the main login. If I close the browser or click the back button, the user is still logged in and you have to click Log out twice to get back to the home page. Do you have any suggestion...Than you once again
-
- Joomla! Apprentice
- Posts: 5
- Joined: Tue Sep 01, 2009 8:05 am
Re: User Specific Login Redirect
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....
b) admin/components/com_user/models/registered.xml...add this at the end...
2: After this go to components/com_user/controller.php...after line 146???
In the login function, change this:
To this:
3: /administrator/components/com_login/admin.login.php... after line 66???
In the login function, change this:
To this:
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
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: Select all
<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" />
Code: Select all
<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" />
In the login function, change this:
Code: Select all
if(!JError::isError($error)){
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return= 'index.php?option=com_user';
}
Code: Select all
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';
}
In the login function, change this:
Code: Select all
if (!JError::isError($result)) {
$mainframe->redirect('index.php');
}
Code: Select all
$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
-
- Joomla! Apprentice
- Posts: 32
- Joined: Mon Jul 06, 2009 8:45 pm
Re: User Specific Login Redirect
Thanks a lot and youy are welcome..
-
- Joomla! Fledgling
- Posts: 4
- Joined: Tue Sep 01, 2009 6:10 pm
Re: User Specific Login Redirect
Raj - I added your code and it works when you create a new user (thank you!)
But when I go back in to EDIT the user, the URL field does not appear, so I can't change it, short of deleting and re-creating the user.
Any thoughts?
Thanks
Jason Green
But when I go back in to EDIT the user, the URL field does not appear, so I can't change it, short of deleting and re-creating the user.
Any thoughts?
Thanks
Jason Green
-
- Joomla! Apprentice
- Posts: 32
- Joined: Mon Jul 06, 2009 8:45 pm
Re: User Specific Login Redirect
When I go to the User Manager and try to create a New USer I do not fonr the fields for Front-end and Backend URL's
-
- Joomla! Apprentice
- Posts: 5
- Joined: Tue Sep 01, 2009 8:05 am
Re: User Specific Login Redirect
The database doesn't have the new parameters for your users until you re-save. In the database under "users" the params field needs to have:
url=
adminurl=
Try creating a new user. Try editing an existing user and coming back. If those things don't work, go into your database and add
url=
adminurl=
to the 'params' part of the user entry in the jos_users table
Best,
iamwaggle
url=
adminurl=
Try creating a new user. Try editing an existing user and coming back. If those things don't work, go into your database and add
url=
adminurl=
to the 'params' part of the user entry in the jos_users table
Best,
iamwaggle
-
- Joomla! Apprentice
- Posts: 5
- Joined: Tue Sep 01, 2009 8:05 am
Re: User Specific Login Redirect
I do get the Front-end/Back-end fields with a new user creation. I don't know why you wouldn't unless you didn't change the XML docs correctly. Maybe a cache thing?
-
- Joomla! Apprentice
- Posts: 32
- Joined: Mon Jul 06, 2009 8:45 pm
Re: User Specific Login Redirect
I can email you the screen shot of the new user creation page....My wmail id is: [email protected]
-
- Joomla! Apprentice
- Posts: 9
- Joined: Wed May 13, 2009 6:38 pm
Re: User Specific Login Redirect
sorry if im hijacking the thread a little, but pulling out hair is beginning to make me go bald, Im trying to get a user specific thing going too, but its not working.
I have managed to make a "redirect to" based on users.
But i want to add a menu item that pops up specific to that logged in user.
I.E. we look at the menu on our main page and it has items on it like: home, work, clients, latest news, about us, contact us and client login.
now i want an item to appear after client login once a user has logged in (just like if u set a menu items access level to "registered user") BUT i want that item to link to a page SPECIFIC TO THE CURRENT LOGGED IN USER.
Any help/ideas?
All help greatly appreciated
I have managed to make a "redirect to" based on users.
But i want to add a menu item that pops up specific to that logged in user.
I.E. we look at the menu on our main page and it has items on it like: home, work, clients, latest news, about us, contact us and client login.
now i want an item to appear after client login once a user has logged in (just like if u set a menu items access level to "registered user") BUT i want that item to link to a page SPECIFIC TO THE CURRENT LOGGED IN USER.
Any help/ideas?
All help greatly appreciated
-
- Joomla! Apprentice
- Posts: 15
- Joined: Sat Sep 05, 2009 4:14 pm
Re: User Specific Login Redirect
Hello to all, i am using Joomla! 1.5.13.
I need to have 2 pages show up as home page, one for public and one for users that are logged in/registered. I have created them both and i made one Public and the other Registered (Access Level ). When i am not log in i see the public page ok. But when i log in i see the article for registered users...but also below that article the public one also appears. What am i doing wrong?
can you help me?
thank you
I need to have 2 pages show up as home page, one for public and one for users that are logged in/registered. I have created them both and i made one Public and the other Registered (Access Level ). When i am not log in i see the public page ok. But when i log in i see the article for registered users...but also below that article the public one also appears. What am i doing wrong?
can you help me?
thank you
-
- Joomla! Guru
- Posts: 692
- Joined: Thu Aug 18, 2005 10:51 pm
- Location: Austria
- Contact:
Re: User Specific Login Redirect
1. use the lates Joomla version (actual 1.5.14)!
2. this is how Joomla works: each higher ACL level can see all his items AND what is for lower levels (same for frontend as well for the backend)
2. this is how Joomla works: each higher ACL level can see all his items AND what is for lower levels (same for frontend as well for the backend)
http://www.joomx.com - custom extensions and development
http://www.joomlasupportdesk.com - support, migration, training and consulting
Member of the German Joomla Translation Team
http://www.joomlasupportdesk.com - support, migration, training and consulting
Member of the German Joomla Translation Team
-
- Joomla! Apprentice
- Posts: 8
- Joined: Fri Jun 02, 2006 5:37 am
Re: User Specific Login Redirect
I am so glad I found this. Thank you iamwaggle, sraj49, and Olaf! And it works great.
However, my user information details do not show the url field when I return after saving. I double checked all the edits/hack. I have even made sure the "url=" was added to the param in the database (per your suggestion iamwaggle). I don't believe it is a cache issue either.
Does anyone have another suggestion why I cannot see the url (except for the very first time a new user is created)?
Thanks all
However, my user information details do not show the url field when I return after saving. I double checked all the edits/hack. I have even made sure the "url=" was added to the param in the database (per your suggestion iamwaggle). I don't believe it is a cache issue either.
Does anyone have another suggestion why I cannot see the url (except for the very first time a new user is created)?
Thanks all
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Oct 22, 2009 4:34 pm
Re: User Specific Login Redirect
How do I get my login page to bring up the specific page? Where do I "link" it?
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
Do you use the mod_login module?
Olaf
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Oct 22, 2009 4:34 pm
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
Did you look into the module parameters? There is an option to add the login URL.
Olaf
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Oct 22, 2009 4:34 pm
Re: User Specific Login Redirect
I guess I don't see that in the module. Also, when I try to login now, I'm getting this error message: "Fatal error: Unsupported operand types in /home1/stonewor/public_html/includes/router.php on line 148". Do you know what this means? I am extremely new to Joomly and website creation in general. Thanks in advance.
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
My guess would be that the Menu Item which you selected doesn't exist, or that the article which linked from the menu item doesn't exists anymore.
Olaf
Olaf
You do not have the required permissions to view the files attached to this post.
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Oct 22, 2009 4:34 pm
Re: User Specific Login Redirect
Why can't I see all of my articles under "Paremeters" in the mod_login, for "Login Redirection Page" and "Logout Redirection Page"? I'm trying to link these to a page that I created but they don't show up.
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
You can only select a menu item? Do you will need to create a menu item first.
Olaf
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Oct 22, 2009 4:34 pm
Re: User Specific Login Redirect
What if I don't want that page to show up in my menu on the frontend? (It's for certain level employees only.)
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
Try to create a new menu, a new menu item, and don't link the menu with a module.
Olaf
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jan 03, 2008 2:16 pm
Re: User Specific Login Redirect
ok.... i have used the trick described in the first page. I now upgraded to 1.5.14 now when i create a new user and input a redirect url.... it doesn't redirect.
For some reason, the user that i did this trick with before the upgrade do redirect.
Can someone post their controller.php code or file plus their other modification to their other files (user.xml etc) to get this redirect working.
Thanks
~G
For some reason, the user that i did this trick with before the upgrade do redirect.
Can someone post their controller.php code or file plus their other modification to their other files (user.xml etc) to get this redirect working.
Thanks
~G
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
Did you change all the files again?
Olaf
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jan 03, 2008 2:16 pm
Re: User Specific Login Redirect
no i didnt change the files again....
oooo i looked into the 1.5.7 to 1.5.14 update file and i see that controller.php gets replaced.
So im assuming i just modify controller.php with any of the hacks above?
Thanks,
~Greg
oooo i looked into the 1.5.7 to 1.5.14 update file and i see that controller.php gets replaced.
So im assuming i just modify controller.php with any of the hacks above?
Thanks,
~Greg
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
Yes, or any other file which might have been replaced.greg218 wrote:So im assuming i just modify controller.php with any of the hacks above?
Olaf
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jan 03, 2008 2:16 pm
Re: User Specific Login Redirect
The joomla 1.5.14 controller.php looks different and i can't find this closest i found is
Can someone show how you would do this hack in joomla 1.5.14?
Thanks!
~Greg
Code: Select all
if(!JError::isError($error)){
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return= 'index.php?option=com_user';
}
Code: Select all
if (!$user->bind($post))
{
$mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
$mainframe->enqueueMessage($user->getError(), 'error');
//$mainframe->redirect( 'index.php?option=com_users', $user->getError() );
//return false;
return $this->execute('edit');
}
Thanks!
~Greg
- ooffick
- Joomla! Master
- Posts: 11615
- Joined: Thu Jul 17, 2008 3:10 pm
- Location: Ireland
- Contact:
Re: User Specific Login Redirect
Hi Greg,
Please make sure you are looking in the /components/com_users/controller.php and not in the /administrator/components/com_users/controller.php file.
Try to find this:
and replace it with this:
Olaf
Please make sure you are looking in the /components/com_users/controller.php and not in the /administrator/components/com_users/controller.php file.
Try to find this:
Code: Select all
$credentials = array();
$credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
$credentials['password'] = JRequest::getString('passwd', '', 'post', JREQUEST_ALLOWRAW);
//preform the login action
$error = $mainframe->login($credentials, $options);
if(!JError::isError($error))
{
// Redirect if the return url is not registration or login
if ( ! $return ) {
$return = 'index.php?option=com_user';
}
$mainframe->redirect( $return );
}
Code: Select all
$credentials = array();
$credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
$credentials['password'] = JRequest::getString('passwd', '', 'post', JREQUEST_ALLOWRAW);
//preform the login action
$error = $mainframe->login($credentials, $options);
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';
}
$mainframe->redirect( $return );
}
Olaf Offick - Global Moderator
learnskills.org
learnskills.org
-
- Joomla! Apprentice
- Posts: 20
- Joined: Thu Jan 03, 2008 2:16 pm
Re: User Specific Login Redirect
Thanks Olaf, It worked!
-
- Joomla! Intern
- Posts: 64
- Joined: Sun Jun 04, 2006 10:25 pm
Re: User Specific Login Redirect
I wish to have some time, to create a generic plugin for this.
If anyone has already created one, please let me know.
If anyone has already created one, please let me know.
Speed Up Joomla https://codingmall.com/products-mainmen ... oomla-site
Membership & Access Control - https://codingmall.com/products-mainmen ... ss-control
Membership & Access Control - https://codingmall.com/products-mainmen ... ss-control