Disable and redirect Joomla "User Profile" page

Previously, in this article, I explained how to redirect users after registration to any page on your website thus avoiding User Profile page after they login for the first time.

If New User Account Activation is set to None (activation not required) this is all you need to avoid User Profile page. However, if Account Activation is set to Self (activation via an email link) this is not enough. When users click on a link in the activation email, they are taken to a login form and if they use it to login, they get to the User Profile page.

There may be other ways to prevent this, and if you know a better one, let me know, but this is how I solved it:

Open file components/com_users/views/profile/tmpl/default.php

This is how it looks:

 
<?php
/**
* @package           Joomla.Site
* @subpackage        com_users
* @copyright         Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license           GNU General Public License version 2 or later; see LICENSE.txt
* @since             1.6
*/
 
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
?>
<div class="profile<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
     <?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
 
<?php echo $this->loadTemplate('core'); ?>
 
<?php echo $this->loadTemplate('params'); ?>
 
<?php echo $this->loadTemplate('custom'); ?>
 
<?php if (JFactory::getUser()->id == $this->data->id) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_users&amp;task=profile.edit&amp;user_id='.(int) $this->data->id);?>">
      <?php echo JText::_('COM_USERS_Edit_Profile'); ?></a>
<?php endif; ?>
</div>
 

You need to delete all code between lines 14 and 29 and replace it with:

<?php header( 'Location: http://www.mysite.com/mypage' ) ; ?>

Now code should look like this:

 
<?php
/**
* @package          Joomla.Site
* @subpackage       com_users
* @copyright        Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license          GNU General Public License version 2 or later; see LICENSE.txt
* @since            1.6
*/
 
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
?>
<div class="profile<?php echo $this->pageclass_sfx?>">
<?php header( 'Location: http://www.mysite.com/mypage' ) ; ?>
</div>
 

Be aware that this completely disables User Profile page! All attempts to access this page from any part of your website will be forwarded to the page you provided. Only use this if you sure you don't need User Profile page at all.

Joomla 1.6
Joomla 1.7
Joomla 2.5

Comments  

Econoclasta
-1 # Econoclasta 2014-12-01 17:39
I was looking for a solution to redirect users after registration and I am glad I found your previous article on this issue. It helped me to solve the problem.

I also have Account Activation set to Self so I had the problem you mentioned. I thought the solution should be in the same file and I found it just by chance. it was there!

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

At around row 86 look for this under the comment // Redirect to the login screen

elseif ($useractivatio n == 1)
{
$this->setMessage(JText::_('COM_USERS_REGISTRATION_ACTIVATE_SUCCESS'));
$this->setRedirect(JRoute::_('index.php?option=com_users&view=login', false));

Change the route in the last row to the location you want to redirect the user. It should read like this: $this->setRedir ect(JRoute::_(' http://www.mysi te.com/mypage', false));

I hope it helps :D
decaPeter
# decaPeter 2014-07-28 15:35
perfect! that's exactly what i wanted to do! THANKS!!
Riality
# Riality 2014-01-21 13:57
Finally a solution for this problem !

This is exactly what I was looking for! Thanks!
Aldo Poma
# Aldo Poma 2013-04-06 08:47
Thank you very much! It runs! :-)
-000
# -000 2013-04-01 10:53
9i
Alison
# Alison 2012-10-25 09:12
I have been trying to figure this out for ages
it was making me like this :cry: :o :cry:
thank you so much
now I look like this :-) :-) :-)

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