Skip to Content Skip to Menu

🌟Discover the Joomla AI Plugin that wrote its own story! - CB Editor Assistant 1.1now for Joomla 3, 4 & 5!
✍️ 5-Day Free Trial, then 🎯 save up to 30% with our 🛍️ Intro Offer (First 50 users, ends Dec. 25th)
🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

cb auto action- assigning usergroup based on cb field value

  • sofast_x
  • sofast_x
  • OFFLINE
  • Posts: 6
  • Thanks: 0
  • Karma: 0
4 years 6 months ago #319241 by sofast_x
hello. i just purchased the cb auto action and facing some problems. i need to know any other resources and tutorial on the matter. the documentation and video tutorials are not helping. i have no knowledge of coding at all.

I'm trying to configure a scenario similar to this. i tried to implement it but unsuccessful.

www.joomlapolis.com/documentation/291-cb-auto-actions/tutorials/18237-cb-auto-actions-assigning-usergroup-based-on-cb-field-value


i have attached what i did. please guide me to solve this and please provide me other resources for my reference. Thanks


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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
4 years 6 months ago #319255 by krileon
Your condition is likely where it's failing. You need to compare cb_usertype to the values actually in that field. The tutorial you linked was for when field conditions weren't available in the dropdown (so you couldn't select cb_usertype) for example. Example as follows.

Field: cb_usertype
Operator: Equal To
Value: student

With the above it expects cb_usertype has a value of student. This should match the value in cb_usertype exactly. So if cb_usertype is a select field you'd have the below option for example.

Option 1
Value: student
Label: Student


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.

  • sofast_x
  • sofast_x
  • OFFLINE
  • Posts: 6
  • Thanks: 0
  • Karma: 0
4 years 6 months ago #319258 by sofast_x
thanks for the quick reply. i want users to be able to select the usergroup during registration.

should i just

should i put a [ ] like [student] in the value and label boxes?

created radio button for cb_usertype and match the value within auto action conditions field cb_usertype, while action mode i selected "add usergroups"

please refer attachments
Attachments:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
4 years 6 months ago - 4 years 6 months ago #319275 by krileon

should i put a [ ] like [student] in the value and label boxes?

You don't need to put brackets in the values. For student just have it be "student" (without quotes). Your issue is the conditions. You're conditioning multiple times the same field. You currently have the below configured

cb_usertype Equal To [Students]
AND
cb_usertype Equal To [Parents]
AND
cb_usertype Equal To [Tutors]
OR
cb_usertype Equal To [Coaches / Instructors]

That doesn't make any sense. You can't have an AND condition against a field that can only have 1 value. You are trying to put all of this in a single auto action. You can't do that. You need to have 1 auto action per usergroup assignment. So you'd have the below.

Auto Action 1
Global
Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUserUpdate, onAfterUpdateUser (covers frontend/backend registration/edit)
Type : Usergroup
User: Automatic
Access: All Non-Moderators (we don't want moderators accidentally losing their usergroups)
Conditions
cb_usertype Equal To [Students]
Action
Mode: Replace Usergroups
Groups: Registered, Students

Auto Action 2
Global
Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUserUpdate, onAfterUpdateUser
Type : Usergroup
User: Automatic
Access: All Non-Moderators
Conditions
cb_usertype Equal To [Parents]
Action
Mode: Replace Usergroups
Groups: Registered, Parents

etc...


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.
Last edit: 4 years 6 months ago by krileon.

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

  • sofast_x
  • sofast_x
  • OFFLINE
  • Posts: 6
  • Thanks: 0
  • Karma: 0
4 years 6 months ago #319283 by sofast_x
thank u so much krileon. I understood and tried according to your explanation but seems like all new registered users only entered registered group.
i received this error upon registration.

Error
:: Action 95 :: Access check for user 1000261 failed: looking for -4 in -1, -6, -5, -3, 2

can i set the field to be multi select? auto action still the same configuration?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
4 years 6 months ago #319294 by krileon
It failed because the user you're editing is a moderator. It's specifically configured so it doesn't alter moderators usergroups. Test with a regular registered user.


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