When a user signs in in Joomla, he is automatically redirected at homepage.
This article explains you how to add a hack in Joomla 1.5, to redirect the user to the page of your choice after he signed in. It may be useful, especially if you want the user to do a specific action (e.g. : to post an article, a picture, subscribe to your services, etc.). From back-end, you may specify a Joomla! page for redirection, but no custom URL.
I used Joomla 1.5.8 for this example, but it should be the same pattern for every other J1.5.x version.
Open this file :
[votre site]/components/com_user/controller.php
Look for this code line, that should be located at line 163, inside the login() function :
login() :
All you have to do is to replace $return by the URL where you want users to be redirected. For instance :
Ce message est également disponible en : French
in the login form module have this option integrated.
Yes but you must choose a “Joomla!” page, you can’t write a custom URL.
Thanks much for this nice piece of text.
i was happy to find this post…but this does not work when i tried it. I am trying to have user redirect to my custom page and not home page after they register.
Let me know if you have any suggestions.
Hi, Thanks for you interest! Just type the URL of your custom page instead of current (home) URL, but I guest you may have already tried this
If it doesn’t work, would you post here your code please so we can have a look at it
Thank you for this helpful post, I searched around and around for the solutetion and so happy to find your blog
Thanks, little problem in fact, but very helpful your description!
Thank you for helping.. great Job
Thinks for tg this tutoriel,i want to know how to redirect the user to the privious page after signing in.
I tried this but it didn’t work, maybe because i was using a login page instead of login module on the side.
I solved it by editing index.php – the idea is to detect that it’s a login page and add a base64_encode return url on the current URL. It might be a bit dodgy but it works for me.
//if the page is login page – find out ur query string by ‘echo’ it
if($_SERVER['QUERY_STRING'] == ‘option=com_user&view=login&Itemid=21′){
//this is where you want to redirect user
$returnURL = base64_encode(‘index.php/component/ezrealty/?controller=properties&task=add’);
//using js redirect to add your default ‘return url’
echo ““;
}
If you have the same problem, hopefully it would help