Dev & Tech Notes
San Diego | Los Angeles | Big Bear | USA
Terms & Conditions ©2005-2024 TJohns.co
Terms & Conditions ©2005-2024 TJohns.co
Articles in this Category
- Add Dropdown Category List to Joomla
- Booking & Reservation Extensions
- Echo Usergroup - Specific Class for Different Usergroups
- Getting the Intro & Full Text Images for Custom Article Template
- How to Get User Name - Joomla 3
- How to Use Shortcodes in Joomla Template Files via PHP
- Insert Code for Specific Component
- Inserting, Updating, & Deleting Data via JDatabase
- Joining Across Multiple Tables Example
- Joomla Custom Fields Don't Work
- Joomla Extension Directory - Fake Reviews
- Joomla Extension Directory = GARBAGE
- Layout Overrides (alternative layout)
- No Input Field for Tags on Front End 'Create Article'
- Reading & Writing to the Joomla Database
- Redirect Joomla Home Page for Different User Groups
- Remove Joomla Tooltips
- test notification
- Unique Body Class in Joomla 3
Top Left Text cha
Web & App Development
Redirect Joomla Home Page for Different User Groups
- Details
- Written by Timothy Johns
- Category: Joomla
- Hits: 6183
I've looked and looked... there's nothing in the JED that works for this. There is one plugin that supposedly does this (Nomad), but all it really does is through up a bunch of JS errors in the console when you try to add more than 1 rule. Even tried manipulating the database data for the plugin and couldn't get it working. Seems simpler to just write a PHP script and stick it in a custom HTML module (I use Custom HTML Advanced) - and assign that to the home page only. Here's the script...
<?php
$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group) {
if ($group==10) {
$goto =& JFactory::getApplication();
$goto->redirect('/jobseeker-control-panel');}
if ($group==11) {
$goto =& JFactory::getApplication();
$goto->redirect('/employer-control-panel');}
}
?>
So there's no need to install a plugin for something this simple. That is, if there were such a plugin.
Of course you'll have to change the group numbers and redirection URL. Just look in the user group manager to decide what number to replace '10' and '11' with. And I'm sure you can figure out where you need them redirected to.
<?php
$user = JFactory::getUser();
$groups = $user->get('groups');
foreach($groups as $group) {
if ($group==10) {
$goto =& JFactory::getApplication();
$goto->redirect('/jobseeker-control-panel');}
if ($group==11) {
$goto =& JFactory::getApplication();
$goto->redirect('/employer-control-panel');}
}
?>
So there's no need to install a plugin for something this simple. That is, if there were such a plugin.
Of course you'll have to change the group numbers and redirection URL. Just look in the user group manager to decide what number to replace '10' and '11' with. And I'm sure you can figure out where you need them redirected to.
-
Guest - Marshall S
PermalinkI know this is an old thread but I have one question with this code. First, thank you, I have implemented it and works like a charm for those who are part of one group! Now the question - What would be the best way to handle those users who are part of two groups listed in the code. I thought I could work the order to create a hierarchy but it servers up the same group redirect no matter the order. Any help would be appreciated. Thank you
0 Like -
Comments (4)