CB Usergroups substitution for user

1 week 3 days ago #337921 by activha
CB Usergroups substitution for user was created by activha
Hello

Is there a simple CB substitution to get all the user groups that a user belongs to with CB ?
I mean in a CB code autoaction when we'll get the user object

Thanks a lot

Please Log in to join the conversation.

1 week 3 days ago #337922 by activha
Replied by activha on topic CB Usergroups substitution for user
OK replying to myself I think the best solution was to test if they were member of some group with [cb:if usergroup includes "30"]oui[/cb:if]

Can you confirm it's the easiest ?

Please Log in to join the conversation.

1 week 3 days ago #337925 by krileon
Replied by krileon on topic CB Usergroups substitution for user

OK replying to myself I think the best solution was to test if they were member of some group with [cb:if usergroup includes "30"]oui[/cb:if]

Can you confirm it's the easiest ?

Correct, using the IF condition would be the only way to do this.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: activha

Please Log in to join the conversation.

1 week 2 days ago - 1 week 2 days ago #337944 by activha
Replied by activha on topic CB Usergroups substitution for user
I have an issue on this trying to get [cb:if usergroup includes "30" user_id="[post_member]"]client[/cb:if]

it seems like this substitution does not support a parameter ?

I set the user with a code which gives me its [user_id]

if [user_id] = [post_member] I can correctly use the check but if not it gives an empty value.

Could you check ?
What I need is to check if a member has a valid connection with a user identified by its token (which works fine) but also to identify the groups of the member.

So I reverted by using a direct SQL call to __user_usergroup_map which seems easier

Please Log in to join the conversation.

1 week 2 days ago #337948 by krileon
Replied by krileon on topic CB Usergroups substitution for user
"user_id" does not change the source of the substitutions. It's meant to condition against the user_id of the substitutions user. To change the substitutions user you need to use "user" and it should be the first parameter. So the below should work fine.
[cb:if user="[post_member]" usergroup includes "30"]client[/cb:if]


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.620 seconds

Facebook Twitter LinkedIn