CB Auto Action - Add Group - not working?

2 years 8 months ago #325582 by mew
I'm trying to make the CB Auto Action work. If the registered or logged-in user has an email from a certain set of domains, I want this user to be added to a specific Joomla Group.

Somehow I can't get it to work, and obviously need some pointers. Any help is appreciated.

I used this page for help till now:
CB Auto Action

Please Log in to join the conversation.

2 years 8 months ago #325584 by krileon
Replied by krileon on topic CB Auto Action - Add Group - not working?
That example auto action is meant for profile update or registration. It's checking if the value of the field has changed. You'll need different conditions to handle login. The below should work for you.

Global
Triggers: onAfterLogin
Type: Usergroup
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Usergroups
User: Action User
Operator: Does Not Have
Usergroups: USERGROUP_TO_ADD_HERE
Condition 2
Field: email
Operator: Is REGEX
Value: EMAIL_DOMAIN_REGEXP
Action
Mode: Add Usergroups
Groups: USERGROUP_TO_ADD_HERE

Replace USERGROUP_TO_ADD_HERE with the usergroup or usergroups you want to add to the user in both the condition and the action. The condition is to ensure we don't try and add a usergroup they already have. Next you'll need to write the regex for EMAIL_DOMAIN_REGEXP to match the domains. Example as follows.

/@(domain_1\.com|domain_2\.com)$/

Each new domain is separated with | and be sure to escape the period with \ so it will actually be treated as a period.


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

Facebook Twitter LinkedIn