CB Auto Action: please help

3 years 11 months ago #318350 by denisp
CB Auto Action: please help was created by denisp
Hello Support team,
yes, I need your support because I need the funciotnality of Cb Auto Action,
but I understand that the usage is not si easy ... so let's start.

My scenario:
-user registration form.
-In my form there is custom field. it is a Date Picker field.

User has to compile this field the date of his certifcation.
his certification will expire after 3 years.

So What I need to achieve with Cb Auto Action is this result.

A) Today, user John Doe fills in the form.
And his certification is dated 2019-01-01
B) John is correctly registered (he is a Registered user in Joomla, don't know if this important)
C) John, if searched in the CB database, will be shown in the list of the users.

BUT

D) when his certifcation will expire (2022-01-01), John MUST be unpublished from the list of all users
and if searched, his entry will not been shown up.

ok that's it.
please can you help me?

thanks in advance
denis

Please Log in to join the conversation.

3 years 11 months ago #318373 by krileon
Replied by krileon on topic CB Auto Action: please help

C) John, if searched in the CB database, will be shown in the list of the users.

When searching where? On frontend? If on a frontend userlist it maybe better to just exclude users who have expired certifications entirely, which you can do by adding an Advanced filter to your userlist. This can be done as follows.

DATE_ADD( ue.`FIELD_NAME`, INTERVAL 3 YEAR ) > NOW()

Replace FIELD_NAME with the name of your date field then add this to your userlist under Filters after selecting Advanced. This will add 3 years to the date they supplied and check if it's greater than the current date. If it is they aren't expired and will output in your list. If it's not then they won't show in the list at all.


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.

3 years 11 months ago - 3 years 11 months ago #318506 by denisp
Replied by denisp on topic CB Auto Action: please help
Thank you Kyle
right now the scenario is a little bit different, because of:

1 - the actions are changed :(

2 - I need the step by step configuration.
Please, be patient, I'm sorry but I read tutorials, saw CB Videos on YouTube,
and I understand that CB AA is very powerful and I don't believe I can manage correctly.
I need to understand what is the trigger to setup, and how to
setup the codition to make CB AA work fine

So here it is again my scenario:


- I have a user registration form.
- In my form there is custom field. it is a Date Picker field.
- Consider that this Date Picker will save dates about a certification date, after an exam.
- This certification lasts 3 years

e.g.: I have passed the exam 13 - may - 2018, so in my date picker I will
insert 13 - may -2021 because my certification lasts 3 years.

I have passed the exam 01 - june- 2020 ? my certification will expire 01-june-2023.

Ok, right now in CB everything is working right, and
when a user subscribes the form, his name will be published on the front-end in the userlist.

CB Auto Action should work for automate this 2 actions:

A ) when "today" is the day of the expiry of the certificate,
CB AA should unpublish the user from the userlist in the frontend.

B ) when "today" is the day of the expiry of the certificate,
CB AA should send an e-mail (if doable) to the user, telling him "Hey your certificate is expired!"

thanks again
denis

Please Log in to join the conversation.

3 years 11 months ago #318536 by krileon
Replied by krileon on topic CB Auto Action: please help
CB Auto Actions performs actions on events. You don't have an event for it to act on. So your only options are to run your auto actions on every user on the site using Internal Users and a CRON task or acting on something like onAfterLogin to perform the action anytime a user logs in. Neither of these are perfect solutions for what you're trying to do since CB Auto Actions is not a scheduler. It just performs actions on specified events automatically.

A ) when "today" is the day of the expiry of the certificate,
CB AA should unpublish the user from the userlist in the frontend.

You don't need an auto action for that. My above Advanced Filter added to a Userlist will do that automatically for you.

B ) when "today" is the day of the expiry of the certificate,
CB AA should send an e-mail (if doable) to the user, telling him "Hey your certificate is expired!"

Only way to do that is to create an auto action with Triggers set to Internal Users. This will cause the auto action to execute against every user on your site when you run the Internal Users URL in CB Auto Actions > Parameters. Typically you schedule a CRON task to perform a wget against that URL regularly. In your Conditions is where you would perform your date check, which would be as follows.

Global
Triggers: Internal Users
Type: Email
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [cb:parse function="time" time="+3 YEARS"][FIELD_NAME][/cb:parse]
Format Functions: SELECTED
Operator: Less Than or Equal To
Value: [cb:parse function="time"][cb:date format="Y-m-d" /][/cb:parse]
Format Functions: SELECTED

Replace FIELD_NAME with the name of your date field. This condition would allow the auto action to execute if their date field with 3 years added to it is older than the current date. Please be sure to read parameter descriptions carefully. CB Auto Actions is an advanced tool and it is not recommend for those completely new to CB; you can review System Actions in CB Auto Actions > System Actions for examples and inspiration as well.


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.

3 years 11 months ago #318545 by denisp
Replied by denisp on topic CB Auto Action: please help
Thank you Kyle, your directions are clear and they are saving me.
Just one question.

in the advanced fiter and in the CB Auto Actions > Parameters, you tell me to write
DATE_ADD( ue.`FIELD_NAME`, INTERVAL 3 YEAR ) > NOW()

and
[cb:parse function="time" time="+3 YEARS"]

but my scenario is slightly changed: the date that the user
fills in the form is the date of expiration itself.

e.g.

- Today 2020-05-14 I pass the exam and I get the certification.
- On the certificate, the expiration date is 2023-05-14.
- In the CB form, the Date field I'm gonna fill in, is with the expiraton date of my certifcate: 2023-05-14.

So in your code INTERVAL 3 YEAR o +3 YEARS works but for 2026-05-14,
while it should work on the same day ... something like 2023-05-14 = 2023-05-14

I hope I explained myself,
thanks again,
denis

 

Please Log in to join the conversation.

3 years 11 months ago - 3 years 11 months ago #318555 by krileon
Replied by krileon on topic CB Auto Action: please help
Ah, ok since they've supplied the expiration date you don't need to do any additions to the date then. So for your userlist you'd just have the below advanced filter.

ue.`FIELD_NAME` > NOW()

For your auto action condition you'd have the below.

Field: Custom > Value
Custom Value: [cb:parse function="time"][FIELD_NAME][/cb:parse]
Format Functions: SELECTED
Operator: Greater Than or Equal To
Value: [cb:parse function="time"][cb:date format="Y-m-d" /][/cb:parse]
Format Functions: SELECTED


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

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.230 seconds

Facebook Twitter LinkedIn