How to Redirect Specific Users to Specific Pages
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
<param 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**
9 comments
And Ninja Redirect can be used in some situations.
Good tut Matt!
Only controller.php, users.class.php and users.php. Can you help me out?
Thanks
Leave a comment