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&task=profile.edit&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
Leave a Reply