User Specific Login Redirect

Your code modifications and patches you want to share with others.
forum-wawa
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Nov 18, 2009 4:24 pm

Re: User Specific Login Redirect

Post by forum-wawa » Wed Nov 18, 2009 5:12 pm

Fantastic hack. Thanks a million.

One question ( a tiny problem) though.
Presently when a user clicks away from the page to which he was redirected he must logout and then login again to get back to said page. I'd like to have a link, preferably somewhere in the user menu, to this page.

Can someone help with this? Much appreciated

protheist
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Nov 24, 2009 4:35 pm

Re: User Specific Login Redirect

Post by protheist » Tue Nov 24, 2009 4:44 pm

So the solution originally posted by Sraj49 worked beautifully for me. However I have only one question. Is there a way to make a menu link that would take the logged in user to their specified redirection page?

For example, when User 'ABC123' logged in, their unique redirected url is abc123.html, but also when they click on the menu link "User Home" it would also take them back to that same url. But if the User 'DEF456' logged in, their unique redirected url is DEF456.html, but when they click on the menu link "User Home," it would take them back to their url.

Sorry for the lame example, I just wanna make sure what I am asking is understood. Thanks for any help!

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Tue Nov 24, 2009 4:51 pm

You could add a small module to add a link like that.

Olaf
Olaf Offick - Global Moderator
learnskills.org

protheist
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Nov 24, 2009 4:35 pm

Re: User Specific Login Redirect

Post by protheist » Tue Nov 24, 2009 5:16 pm

That's what I am trying to figure out. What that url would look like that would pull up that user's specific redirection page.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Tue Nov 24, 2009 5:26 pm

You would need to create a new module to add this link.

Olaf
Olaf Offick - Global Moderator
learnskills.org

Sparky9292
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Sat Jun 13, 2009 11:21 pm

Re: User Specific Login Redirect

Post by Sparky9292 » Sun Nov 29, 2009 12:10 am

ooffick wrote:You would need to create a new module to add this link.

Olaf
How do you get a module to display for a specific user only? ??? The access levels in Joomla are too general. You only get the choices of Public, Registered or Special. There's no list of users that you can pick from.
Last edited by Sparky9292 on Sun Nov 29, 2009 12:23 am, edited 1 time in total.

Sparky9292
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Sat Jun 13, 2009 11:21 pm

Re: User Specific Login Redirect

Post by Sparky9292 » Sun Nov 29, 2009 12:18 am

protheist wrote:So the solution originally posted by Sraj49 worked beautifully for me. However I have only one question. Is there a way to make a menu link that would take the logged in user to their specified redirection page?

For example, when User 'ABC123' logged in, their unique redirected url is abc123.html, but also when they click on the menu link "User Home" it would also take them back to that same url. But if the User 'DEF456' logged in, their unique redirected url is DEF456.html, but when they click on the menu link "User Home," it would take them back to their url.

Sorry for the lame example, I just wanna make sure what I am asking is understood. Thanks for any help!
The only way I can think of doing is this is to create a module for each of your users and then add the specific link in each Custom HTML module. Then use something like MetaMod (http://www.metamodpro.com/) extension to control when this module shows.

Seems like a "jank" way of doing this.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Mon Nov 30, 2009 10:02 am

If you don't like MetaMod, you will need to develop you own small little module.

Olaf
Olaf Offick - Global Moderator
learnskills.org

kskamalakumar
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Tue Oct 13, 2009 3:39 pm

Re: User Specific Login Redirect

Post by kskamalakumar » Tue Jan 12, 2010 9:15 am

Hi,
any one help me to set redirection for first time users after successful registration. I am using joomla 1.5.10. I want to set redirect only for the first time users to invite friends page.

Kamal.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Tue Jan 12, 2010 2:31 pm

kskamalakumar wrote:Hi,
any one help me to set redirection for first time users after successful registration. I am using joomla 1.5.10. I want to set redirect only for the first time users to invite friends page.

Kamal.
First, I would recommend to update to 1.5.15

Olaf
Olaf Offick - Global Moderator
learnskills.org

wadesigns
Joomla! Intern
Joomla! Intern
Posts: 71
Joined: Fri Oct 02, 2009 8:39 am

Re: User Specific Login Redirect

Post by wadesigns » Tue Feb 09, 2010 11:07 am

JoshuaLewis wrote:I used Qwomg's instructions to set this up in Joomla! 1.5.9 and it seems to be working. I still need to do some more testing though.

components/com_user/controller.php appears to have had some changes made since v1.5.8 and this has changed the line numbers that Qwomg referenced.
I found the contents indicated for line 134 are now at 144 and line 160 at 167.

My thanks to barnett and everyone else who has contributed.
Has this changed again as I can not find any of this in my controller.php??

bbalasateesh
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Wed Jun 10, 2009 5:45 am

Re: User Specific Login Redirect

Post by bbalasateesh » Wed Feb 24, 2010 4:56 am

I hope I am placing my query in the right place.

I developed an application in Joomla in which I have 5 types of user logins. Based on the login type each login type has different functionalities and different home pages. Now my question is when a user is already login and try to open the site in different tab, I need to redirect to the users home page based on the login type the user has logged.

For example when user is logged in and opened a new tab and typed the URL then the User should redirect to his home page and not the application home page. Currently my application is redirecting to the home page and clearing all the sessions of the logged user.

Anyone kindly tell me hoe to redirect to the logged users home page when a user has already logged in.

Thanks in advance,
Sateesh B.

ironman2003
Joomla! Intern
Joomla! Intern
Posts: 80
Joined: Wed Nov 23, 2005 5:38 am

Re: User Specific Login Redirect

Post by ironman2003 » Thu Feb 25, 2010 5:00 am

I just cracked the cookie on this one myself so take a look at the post I placed here:

http://forum.joomla.org/viewtopic.php?f ... 2#p2053832

It will give you more details on what I was trying to do and I think it will work just fine.

In short- get the inlineACL plugin and set the permissions for the article you are creating - then create a menu for that article. As far as I know, you can put as many ACL instructions for that plugin in a single article as you need so perhaps no limit. Also, as far as protecting client info - there is no indication in the source code when viewed showing the other client's information which makes it very nice!

the apprentice
Joomla! Guru
Joomla! Guru
Posts: 801
Joined: Wed Nov 18, 2009 3:53 pm

Re: User Specific Login Redirect

Post by the apprentice » Wed Apr 21, 2010 1:44 pm

I'm not really good at hacks (rubbish in fact) so before trying I wanted to know if this could solve my needs:

I have a country map on my homepage and I'd like users when logging to automatically only see the region, county, whatever specific area according to the address they have registered. Feasible of fantasyland with Joomla?

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Wed Apr 21, 2010 2:41 pm

Sure, this is possible without any hacks. All you need to do is use an article which has a (google) map in it, and allow it show after the login.

If you prefer to do that on a country level/region with custom level maps meta mod is probably the best option, with the free GeoLite Country or City library.

However, I think you should open a new thread about that and don't hijack this one.

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Wed May 19, 2010 11:54 pm

Hi Guys,

This is great above and exactly what I am looking for but I am seriously stuck.

I have followed the intructions for the redirection of users, I have checked MyPhpAdmin and the login=* and logout=* has appeared in the params field. I think I have inputed the controller coding correctly, but when a user logs in, it doesn't re-direct them and the same for the user loggin out.

The link to the website in question is: -

http://www.ips-photography.co.uk

My guess is that there is something wrong at the controller.php end, but pelase can somebody help becasue it is driving me potty!!!!

Cheers in advance

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Thu May 20, 2010 8:53 am

Which Joomla version do you have?

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Thu May 20, 2010 6:21 pm

Version 1.5.17

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Thu May 20, 2010 9:01 pm

And what did you change so far?
Did you change the xml file?
Did you change the controller file?

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Sun May 23, 2010 3:46 am

Yeah I've changed the xml file and also the controller file.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Sun May 23, 2010 11:36 am

And did you type a URL into the User's profile?

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Sun May 23, 2010 2:58 pm

No it was a drop down list.

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Sun May 23, 2010 4:40 pm

ok,can did you select a value, was that value saved in the database?

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Sun May 23, 2010 4:50 pm

in the database it said Login=2 logout=1, but in the drop down fields it would say Home or About Us. As I change which page to view in the drop downs the number will change in the URL. Hope that makes sense

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Sun May 23, 2010 5:07 pm

ok, and which part doesn't work.

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Sun May 23, 2010 5:12 pm

when you log in it doesn't redirect anywhere

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Sun May 23, 2010 8:19 pm

ok, which controller did you change (this one: /components/com_users/controller.php) and how does your change look like?

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Mon May 24, 2010 5:20 pm

yep it was that one and here is the change: -

if(!JError::isError($error))
{
$user =& JFactory::getUser();
$user->getParameters();
$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 );
}
else
{

User avatar
ooffick
Joomla! Master
Joomla! Master
Posts: 11614
Joined: Thu Jul 17, 2008 3:10 pm
Location: Ireland
Contact:

Re: User Specific Login Redirect

Post by ooffick » Mon May 24, 2010 6:30 pm

ok, and the where do you get returned to after the login? to index.php?option=com_user or the home page or the login page?

Do you use the login module to login or something like this http://***/index.php?option=com_user&view=login

Olaf
Olaf Offick - Global Moderator
learnskills.org

MickHill10
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed May 19, 2010 11:48 pm

Re: User Specific Login Redirect

Post by MickHill10 » Mon May 24, 2010 9:18 pm

here is the url after I have logged in: -

http://www.ips-photography.co.uk/index. ... n=com_user

I have installed the mod_yoo_login module for the login, but I believe this uses the same script as the normal login module.


Locked

Return to “Core Hacks and Patches”