Everything is for free!
Shop is closed.
Due to health issues support is very limited
Shop is closed.
Due to health issues support is very limited
Redirecting based on usergroup
- dunum2
- Offline
Less
More
- Posts: 44
7 years 8 months ago #9629
by dunum2
Redirecting based on usergroup was created by dunum2
Hello there,
I'm trying to redirect if a user based on usergroups.
Here's my code :
I would like also to add a second case while the usergroup is different.
Thanks for your help !
Best regards
I'm trying to redirect if a user based on usergroups.
Here's my code :
if($user_id){
//logged in
$group = $usergroups[0];
if($group==10){
$redirect_menuitem_id = 177;
}else{
//not logged in
$message = Well it redirect correctly...';
$message_type = 'info';
$redirect_menuitem_id = 146;
// $redirect_url = 'index.php?option=com_users&view=login';
}
I would like also to add a second case while the usergroup is different.
Thanks for your help !
Best regards
Please Log in or Create an account to join the conversation.
- carsten888
- Offline
Less
More
- Posts: 4792
7 years 8 months ago - 7 years 8 months ago #9630
by carsten888
Replied by carsten888 on topic Redirecting based on usergroup
congratulation with being the first to post in this forum
or if you want to also filter on another group
if($user_id){
//logged in
$group = $usergroups[0];
if($group==10){
//group 10
$redirect_menuitem_id = 177;
}else{
//not group 10
$redirect_menuitem_id = 177;
}
}else{
//not logged in
$message = Well it redirect correctly...';
$message_type = 'info';
$redirect_menuitem_id = 146;
//$redirect_url = 'index.php?option=com_users&view=login';
}
or if you want to also filter on another group
$group = $usergroups[0];
if($group==10){
//group 10
$redirect_menuitem_id = 177;
}elseif($group==12){
//group 12
$redirect_menuitem_id = 112;
}else{
//not group 10 or 12
$redirect_menuitem_id = 177;
}
Last edit: 7 years 8 months ago by carsten888.
Please Log in or Create an account to join the conversation.
- dunum2
- Offline
Less
More
- Posts: 44
7 years 8 months ago #9631
by dunum2
Replied by dunum2 on topic Redirecting based on usergroup
Yeah first one
!
Sorry, but still does not work...
Now into the url I got this :
my.domain.com/
Based on that code you gave, and I think it's clean, so no br anywhere...

Sorry, but still does not work...
Now into the url I got this :
my.domain.com/
Based on that code you gave, and I think it's clean, so no br anywhere...
if($user_id){
//logged in
$group = $usergroups[0];
if($group==10){
//group 10
$redirect_menuitem_id = 126;
}else{
//not group 10
$redirect_menuitem_id = 146;
}
}else{
//not logged in
$message = Well it redirect correctly...';
$message_type = 'info';
$redirect_menuitem_id = 146;
}
Please Log in or Create an account to join the conversation.
- carsten888
- Offline
Less
More
- Posts: 4792
7 years 8 months ago #9632
by carsten888
Replied by carsten888 on topic Redirecting based on usergroup
note the ' before Well it redirect.
if($user_id){
//logged in
$group = $usergroups[0];
if($group==10){
//group 10
$redirect_menuitem_id = 126;
}else{
//not group 10
$redirect_menuitem_id = 146;
}
}else{
//not logged in
$message = 'Well it redirect correctly...';
$message_type = 'info';
$redirect_menuitem_id = 146;
}
Please Log in or Create an account to join the conversation.
- dunum2
- Offline
Less
More
- Posts: 44
7 years 8 months ago #9633
by dunum2

Works fine, thanks !
Replied by dunum2 on topic Redirecting based on usergroup

Works fine, thanks !
Please Log in or Create an account to join the conversation.
- carsten888
- Offline
Less
More
- Posts: 4792
7 years 8 months ago #9634
by carsten888
Replied by carsten888 on topic Redirecting based on usergroup
you're welcome
Please Log in or Create an account to join the conversation.
Time to create page: 0.129 seconds