[SOLVED] CB auto actions: Assign group based on email at registration

4 years 7 months ago - 4 years 7 months ago #313581 by kommid
Hi,
I have a site for clients that work for one of two companies. If they use their email address @theircompany.tld they are approved automatically and if they use a different email address, they are assigned to the "ungeprueft" (unchecked) group and a mail is sent to the admin. The admin then checks if the person is eligible and if yes, he approves the client by assigning him to the "registered" group. This worked out perfectly until some time ago. Now every user that registers is assigned to "unchecked", even the ones who use their working-email address that ends with theircompany.tld.
Does anyone have an idea why my auto action stopped working suddenly?
I'm on Joomla 3.9.10, CB 2.4.2+build.2019.08.06.20.44.06.cdcb895a1 with cb auto actions 8.0.0+build.2019.07.15.15.08.06.546b490fd.
This is the setup of my auto action:

Global Tab:
Triggers: onAfterUserConfirm
Type: Usergroup
User: Automatic
Access: Everybody

Conditions Tab:
Field: email
Operator: Does Not Conatain
Value: @companyname.tld
I have 3 [OR] rows with different company names an no [AND] row

Action Tab:
Mode: Replace Usergroup
Groups: ungeprueft
user: empty

Output Tab:
Display: None

Uses Tab: everything left default

Parameters Tab: everything left default either.

As mentioned before, strangely it stopped working from one day to another. I have other sites with the same setup, those still work as intended - older version of cb auto action though. Did anything change in how auto actions work?

Best Regards
Markus

Please Log in to join the conversation.

4 years 7 months ago #313584 by krileon
You're using OR conditions to determine if they should be set to "unchecked". So if even 1 of those OR conditions passes they will be set to "unchecked". Your auto action that assigns "registered" should use OR, but your auto action that assigns "unchecked" should use AND. Basically the following.

registered
Field: email
Operator: Does Conatain
Value: @companyname1.tld
or
Field: email
Operator: Does Conatain
Value: @companyname2.tld
or
Field: email
Operator: Does Conatain
Value: @companyname3.tld

unchecked
Field: email
Operator: Does Not Conatain
Value: @companyname1.tld
and
Field: email
Operator: Does Not Conatain
Value: @companyname2.tld
and
Field: email
Operator: Does Not Conatain
Value: @companyname3.tld

You can also condense all 3 down to a single condition as follows.

registered
Field: email
Operator: Is REGEXP
Value: /@(companyname1\.tld|companyname2\.tld|companyname3\.tld)$/

unchecked
Field: email
Operator: Is Not REGEXP
Value: /@(companyname1\.tld|companyname2\.tld|companyname3\.tld)$/

Nothing has changed in regards to how this behaves recently. OR conditions in fact didn't exist before 8.0.0.


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: kommid

Please Log in to join the conversation.

4 years 7 months ago #313661 by kommid
Thank you Kyle!
I guess it's time for a holiday, seems I'm not able to distinguish logical and and or anymore :/
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.414 seconds

Facebook Twitter LinkedIn