Everything is for free!
Shop is closed.
Due to health issues support is very limited

file Group redirection

More
2 years 5 months ago #10932 by assocyate
Group redirection was created by assocyate
I would like to create a simple menu redirect link for users based on the group they belong. Initially I tried to do this with Redirect on login that I own too. It would work if the redirection would be assigned to the user's primary group. Unfortunately, my users belong to multiple groups and assigning to any of these other groups will not work. I thought that Dynamic Menu links program would do the job for me. Unfortunately, it seems that only a redirection that works is if I use a Public group. Even in below example where the user belongs to registered group, it will not redirect to 2861. Instead, it is trying to open the page with id of this redirection menu item. What am I doing wrong? I don't have any other redirection plugin on.

if($user_id){
//logged in
$group = $usergroups[0];
if($group==2){
$redirect_menuitem_id = 2861;
}else{
$redirect_menuitem_id = 1731;
}
}else{
$redirect_menuitem_id = 2861;
}

Please Log in or Create an account to join the conversation.

More
2 years 5 months ago #10935 by carsten888
Replied by carsten888 on topic Group redirection
in
$group = $usergroups[0];
$usergroups is an array. When you use $usergroups[0], you only get the first usergroup in the array. Joomla usergroups have no particular order at all, so you never know if the first usergroup of that array is the one you are trying to match. Better use
if (in_array('2', $usergroups)){
to check if the user is in group 2.

Hope that helps. If not do reply.

Please Log in or Create an account to join the conversation.

More
2 years 5 months ago #10938 by assocyate
Replied by assocyate on topic Group redirection
Thank you. That worked for me.

Please Log in or Create an account to join the conversation.

Time to create page: 0.279 seconds
Powered by Kunena Forum
 
spicy-sacerdotal