Joomla - Redirection after user registration

In Joomla, after successful registration, users by default are redirected to a login page (if account doesn't need to be activated). From there (after logging in) users are redirected to a user profile page. This happens even if you have Login Redirection set to something else in Login Form Module.

To change this behaviour you can redirect users after registration to any other page on your website.
To do this you need to edit a core Joomla file. Be aware that your changes may be overwritten by a Joomla update. Always document changes you make to core Joomla files so you can quickly re-do them if required.

Open file:
components/com_users/controllers/registration.php

Scroll down to the very bottom. Starting line 162 or so you will have flowing code:

 
// Redirect to the profile screen.
 if ($return === 'adminactivate'){
   $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY'));
   $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
}else if ($return === 'useractivate') {
   $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
   $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
} else {
   $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
   $this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));
}
 

In this section you have 3 links starting index.php?

  • First one (index.php?option=com_users&view=registration&layout=complete) is executed after user registration if account has to be activated by an administrator
  • Second (index.php?option=com_users&view=registration&layout=complete), if account has to be activated by user
  • Third (index.php?option=com_users&view=login), if account activation is not required.

Replace links depending on type of registration you use with FULL URL of your redirection page and you are done.
For example, if user activation on my website is not required and I want to redirect users after registration to http://www.mywebsite.com/welcome-reg the updated code will be:

 
// Redirect to the profile screen.
if ($return === 'adminactivate'){
   $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_VERIFY'));
   $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
} else if ($return === 'useractivate') {
   $this->setMessage(JText::_('COM_USERS_REGISTRATION_COMPLETE_ACTIVATE'));
   $this->setRedirect(JRoute::_('index.php?option=com_users&view=registration&layout=complete', false));
} else {
   $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
   $this->setRedirect(JRoute::_('<strong>http://www.mywebsite.com/welcome-reg</strong>', false));
}
 

Regardless to which page on your website you redirect, system message "Thank you for registering..." will be still displayed. If you don't want this message, remove full line above your redirection URL. e.g.  $this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));

If you don't require account activation (New User Account Activation set to None) this is all you need to avoid User Profile page. However, if user has to activate account via email (Account Activation set to Self) this may not be enough. Immediately after registration user will be redirected to a web page you provided in the code as expected. However, when user clicks on a link in the activation email, they will be taken to the previously mentioned login form and if they use it to login, they will get to the User Profile page. To prevent this you can disable User Profile page completely and instead redirect users to any page you like. Read this article to find out how.

Joomla 1.6
Joomla 1.7
Joomla 2.5

Comments  

ryan
# ryan 2015-09-11 04:31
NEWBIE

I want to display a success message after the user clicks on a "Register" button in Registration form process.

Currently no message is displayed. Everything is blank and users are confused... It should display message such as "Thanks for your registration. Confirmation e-mail was sent to your address..".

How can I do that?
Rakun
# Rakun 2015-04-13 13:36
My problem is the message after registration does not show up. It should be message COM_USERS_REGIS TRATION_COMPLET E_ACTIVATE ("Your account has been created and an activation link has been sent...).

I checked registration.ph p file and the line bellow is present there:
$this->setMessage(JText::_('COM_USERS_REGIS TRATION_COMPLET E_ACTIVATE'));

In language manager the chosen language is en-GB and the string for COM_USERS_REGIS TRATION_COMPLET E_ACTIVATE is defined in language file.

Message is also not hidden with css.

What else could be wrong?
Vikram
# Vikram 2013-10-24 13:46
Thanks a lot admin.... It works....
Vikram
# Vikram 2013-10-23 13:20
HI can anyone please help me. I want to remove "Message" word from COM_USERS_REGIS TRATION_ACTIVAT E_SUCCESS message. It is above this message. And I dont want that.
Please help me out guys....
admin
# admin 2013-10-24 08:47
Try adding this to your template's css:
dt.message {display:none;}
Vikram
# Vikram 2013-10-22 07:58
Thanks a lot.... It works for me. I simply edited last else loop of it & redirected the page to thank-you page.
Jim
+2 # Jim 2013-07-05 16:49
The lines of code you posted did not work for me in joomla 2.5

The lines I had to edit were very similar, but higher up in the file:

// Redirect to the login screen.
if ($useractivatio n == 0)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_SAVE_SUCCESS'));
$this->setRedirect(JRoute::_('http://myurl/forum/index.html', false));
}
elseif ($useractivatio n == 1)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('http://myurl/forum/index.html', false));
}
bezlikiy
+1 # bezlikiy 2013-01-22 09:20
you can use for redirect constuction like

JURI::base().'index.php?option=com_users&view=registration&layout=complete'
Maria
-1 # Maria 2012-10-10 15:43
Sorry for this newbie question, but how can i edit or override components/com_ users/controlle rs/registration .php ?
admin
+2 # admin 2012-10-11 07:14
You can edit it in any text editor. How you access it really depends on your hosting company. They all provide some sort of access to your hosted files. Normally via FTP or their own management interface.
Al
# Al 2012-02-29 09:06
I have a link to a pdf that is protected and needs login.
However when I have a new user register successfully, how do i send him to that page where he clicked on the link before?
Right now, it goes back to home page.
I have many pdfs on various pages and would like for new user once registered to be able to get the respective pdf that they clicked originally to be available upon registration immediately.
dukey
+1 # dukey 2012-02-03 01:29
The second option, above, "if account has to be activated by user" does not work. After registering the user is redirected to whatever the admin inputs, and if that is a page only viewable by a registered user, then there is an error. Now, when the user returns via the confirmation link, and inputs credentials, there is again, an error page. Maybe this works for "if account activation is not required" but not if the user clicks on a confirmation email link and returns to fill in credentials.
admin
-2 # admin 2012-02-03 10:28
Hi, yes I only used this with activation set to "none".
This change will redirect users immediately after registration, which I understand still works with activation set to "self" (obviously if you enter URL only accessible to logged on users, there will be an error as users won't be logged on at this point).
This won't change, however, where users are redirected after clicking a link in the activation email.
Svein A. Berg
# Svein A. Berg 2012-01-31 18:09
Thanks a lot! Just what I was looking for!
tebegaya
+3 # tebegaya 2011-09-24 18:33
how i really thank u for this article. this is what i looking for. i was struggling to find out how to redirect user after registration... thanks

Newsletter

Subscribe to receive occasional updates on new posts.
Your email will not be used for any other purpose and you can unsubscribe at any time.
Please wait