Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Black Friday Intro Offer for your subscription's lifetime
🎉 Black Friday sale is here! Great savings on professional and developer memberships! Get 25% off now with code BLACK-FRIDAY-2024!

CB Usergroups substitution for user

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
7 months 6 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 or Create an account to join the conversation.

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
7 months 6 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 or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 months 6 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 or Create an account to join the conversation.

  • activha
  • activha
  • ONLINE
  • Posts: 2334
  • Thanks: 117
  • Karma: 13
7 months 5 days ago - 7 months 5 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
Last edit: 7 months 5 days ago by activha.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48560
  • Thanks: 8292
  • Karma: 1445
7 months 5 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.
Code:
[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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum