How to Redirect Specific Users to Specific Pages

How to redirect specific users to a section or page of my site when they logged in. With this hack the administrator can add a specific Login and Logout Rediect for each user in the User Manager. If no redirect is defined for the user then the login/logout checks to see if there defined a redirect in the login module.

This hack can be used to link users to docman category's, profile pages, forums, etc.

Follow up:

**Make sure you back up all files involved before proceeding**

1.) Open file: /administrator/components/com_users/users.xml

Add this:

param name="login" type="text" default="" label="Login Redirection URL" description="What page will the login redirect to after user login, if let blank will load module default" /&rt
&ltparam name="logout" type="text" default="" label="Logout Redirection URL" description="What page will the login redirect to after user logout, if let blank will load module default" /

Save the file.

2.) Open file index.php

Around line #139 replace:

$mainframe->login();

With this:

$mainframe->login();

// Per User Redirection
$temp_my = $mainframe->getUser();
$params = new mosParameters( $temp_my->params );
$userRedirect = $params->get( 'login', '' );
if ($userRedirect) {
$return = sefRelToAbs( $userRedirect );
}
$temp_my = '';

3.) Around line #168 replace this:

$mainframe->logout();

With this:

// Per User Redirection
$temp_my = $mainframe->getUser();
$params = new mosParameters( $temp_my->params );
$userRedirect = $params->get( 'logout', '' );
if ($userRedirect) {
$return = sefRelToAbs( $userRedirect );
}
$temp_my = '';

$mainframe->logout();

Save the File.
And you're done!

Now you can login to the Administrator end and set the individual redirects in the user manager.

Warning:
If you don't want the frontend users to be able to edit these redirects then you need to set the Frontend User Params: to NO in your Global Configuration.

**Keep in mind that if you make these changes you are editing the core files and any upgrades to Joomla in the future may not be compatible**