Skip to Content Skip to Menu

🌲 Merry Christmas! Great savings on Professional and Developer Memberships! Get 25% off now with code XMAS-2024!

[SOLVED] CB Auto Action ?

10 years 2 months ago #250527 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
The problem is that I need to set a condition with CB Conditional, that is, hide a field from the date of graduation (inserted during registration) to six months later (Example: graduation date 18/10/2014 the field will remain hidden until 18/04/2015). The date field has the format "yyyy mm dd" and no numeric so as to set a condition on a number of days.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
10 years 2 months ago #250590 by krileon
Replied by krileon on topic CB Auto Action ?
CB Conditional doesn't do date comparisons. You can try using Greater Than type usage, but I doubt it'll work. You could only do 1:1 comparison (check that the date is equal to another date). What you could do is create a CB Query Field that does your calculation. If the date is 2015-04-18 or greater than return 1 otherwise return 0 using SQL functions. You'd then condition the query field using Custom > Value conditional usage.


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.

10 years 2 months ago #250639 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
I created a text field (field_1) and with CB Auto Action:

UPDATE `#__comprofiler` SET `cb_field2` = (SELECT DATEDIFF(now(),'[cb_graduationdate]') WHERE `id` = '[user_id]'

write the difference in days (numerical value). Then I use the field1 with CB Conditional and hide the field2, theoretically works. The problem is that the value in field1 is updated only after a user action (Eg. After login) if the user does not login for a long time the value is not updated and the field2 remains visible. Is there a way to update the field in real time or constantly?

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

10 years 2 months ago #250672 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
Sorry, I resolved with the suggestion that you have given me in my previous post, so I adopted the DataDiff in a CB Query Field:

SELECT DATEDIFF(now(),(SELECT `cb_graduationdate` FROM `#__comprofiler` WHERE `id` = '[user_id]')) AS DiffDate

and I saw that the field is updated every day. Now having the numeric field that automatically updates it and I can use the condition.
Thanks.

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

10 years 2 months ago #250802 by pasquale1980
Replied by pasquale1980 on topic CB Auto Action ?
How do I send an e-mail automaticaly, that is, not generated by a user action, but when a CB Query field is equal to a specific value. Example: Field1 = 1 then send e-mail.
Thanks.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48616
  • Thanks: 8302
  • Karma: 1446
10 years 2 months ago #250991 by krileon
Replied by krileon on topic CB Auto Action ?
You need to use the Internal Users trigger then fire the internal users URL found within CB > Plugin Management > CB Auto Actions. You can setup the URL to run in CRON as well so it can be ran at a scheduled time. Internal Users will parse every user on your site through all actions with the Internal Users trigger.


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