Use results from multi-select dropdown to change user group

4 years 4 months ago #315880 by 3cellhosting
Hi guys,

I have a dropdown in registration for job roles. While the majority of members will only have one role there will be members who have combined roles. The dropdown allows for multi-select.

At the moment they default to "Registered" user group but I need to add them to the same groups as their job role. All these have been set up on Joomla ACL.

Would this be a job for Auto Actions? If so, how do I make that happen?

Many thanks

David

David
www.3cellhosting.com - where personality, creativity and integrity come as standard.

Please Log in to join the conversation.

4 years 4 months ago #315883 by krileon
Yup, CB Auto Actions can do that. See the below tutorial on how to change usergroup based off field value.

www.joomlapolis.com/documentation/291-cb-auto-actions/tutorials/18813-change-the-usergroup-based-off-the-value-of-a-field

With Multi-Select fieldtypes though you'll need to adjust the condition a little as follows.

2: [cb_demo] Equal To 1

To

2: [cb_demo] Does Contain 1

You may need to set the Delimiter parameter to |*|.


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.

4 years 4 months ago #315890 by 3cellhosting
Thanks for the quick reply :)

OK - Can I confirm the following please. This is the example...

Global
Triggers: onAfterUserRegistration, onAfterNewUser, onAfterUpdateUser, onAfterUserUpdate
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
1: [var1_cb_demo] Not Equal To [var3_cb_demo]
2: [cb_demo] Equal To 1

Global is as above - so far so good.

Conditions has got me lost. Where do the var1 and var3 elements come from?

https://theconfederationhillingdon.org.uk/screenshot-conditions

https://theconfederationhillingdon.org.uk/screenshot-action

I am guessing cb_demo is replaed with my actual field - cb_jobtitle?

With 27 job titles I am guessing I need 27 auto actions to assign the correct groups.

Do I need to do anything in parameters?

Cheers for now

David

David
www.3cellhosting.com - where personality, creativity and integrity come as standard.

Please Log in to join the conversation.

4 years 4 months ago #315899 by krileon

Conditions has got me lost. Where do the var1 and var3 elements come from?

var1 is the new user object and var3 is the old user object. That condition prevents it from running the auto action when the fields value hasn't changed. All you need to be changing in regards to that condition is cb_demo to whatever the name of your field is.

I am guessing cb_demo is replaed with my actual field - cb_jobtitle?

Correct.

With 27 job titles I am guessing I need 27 auto actions to assign the correct groups.

Correct.

Do I need to do anything in parameters?

Nope.

Please note since you are using a multi-select you do need to use a "Does Contain" condition instead of "Equal To" as noted above.


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.

4 years 4 months ago #315901 by 3cellhosting
Thanks Kyle,

Your comment about "Does Contain" - the example uses a numberas it was a checkbox I believe. Do I use the selected field value?

Thanks again.

David
www.3cellhosting.com - where personality, creativity and integrity come as standard.

Please Log in to join the conversation.

4 years 4 months ago #315905 by krileon

Do I use the selected field value?

Yes, you use the Value for the select option you want to match against.


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.227 seconds

Facebook Twitter LinkedIn