CBSubs Mailer - date math in conditional

3 years 9 months ago - 3 years 9 months ago #319317 by fdinkler
I'm attempting to configure a mailer to send a reminder when a user's expiration date is 90 days/3 months from today's date.
I need guidance in configuring the mailer condition to select users whose expiration date is exactly 90 days from today.

In the mailer, in the Conditions tab, I configured Condition 1 as follows
This condition:
[Selected the appropriate plans and states]
Conditions on latest user subscriptions = Yes
Conditions on already existing user subscriptions - n/a
Dates / CB Fields Comparisons
Date A, Field A or Value A = Expiration Date of existing user subscriptions above
Date B, Field B or Value B = Constant Value or String (CB substitutions...)
Value B = a CB substitution that adds 90 days to the current date, like [cb:date date=DATE()+90 format="Y-m-d" /]
Condition 1 (> for Dates) = A = B

Thanks,
Fred

Please Log in to join the conversation.

3 years 9 months ago - 3 years 9 months ago #319330 by krileon
Replied by krileon on topic CBSubs Mailer - date math in conditional
I think you'd just use the standard comparison parameters and not conditions for that. Believe the below should accomplish that.

Automatically send message at following date: 90 days before
Relative to this date of the plans below: Subscription's Expiry Date
Must be in state: Active
But do not send message if it's later than: And no other date condition
Maximum messages per customer (0=unlimited): 1

That should notify them 90 days before they expire. If you need to add 90 days to a date and compare it to the expiration date then something like the below would work.

First condition: This condition:
Date A, Field A or Value A: Expiry Date of existing user subscriptions above
Date B, Field B or Value B: Constant Value or String (CB substitutions can be used)
Value B: DATE_HERE
Condition 1 (> for Dates): For dates: Date A > Date B + 90 days (Date A must be later than 90 days after Date B )

[cb:date date=DATE()+90 format="Y-m-d" /]

Such functionality does not exist. The date parameter shown in the below tutorial expects a datetime (e.g. 2020-06-26) value there.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18353-using-substitutions-throughout-cb


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 9 months ago #319340 by fdinkler
Replied by fdinkler on topic CBSubs Mailer - date math in conditional
Thanks for the reply.
After some testing, I've confirmed that mailer standard condition of
Automatically send message at following date: 90 days before
will generate emails for all users with a subscription expiration date range of today through 89 days in the future

I'm was looking to email only those users whose expiration date is exactly 90 days away from today.
Is there a way to do that using the CBSubs mailer?

Fred

Please Log in to join the conversation.

3 years 9 months ago #319342 by krileon
Replied by krileon on topic CBSubs Mailer - date math in conditional
Use the "But do not send message if it's later than" parameter to limit the date range. So you'd have the below for example.

Automatically send message at following date: 90 days before
But do not send message if it's later than: 90 days before

I'm not entirely sure that will work or if it'll just cause it to exclude everyone. Aside from that the best I can suggest is probably to try a code field provided by CB Code Field, add 90 days to the current datetime using PHP, then condition the expire day against that code field.


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 9 months ago - 3 years 9 months ago #319343 by fdinkler
Replied by fdinkler on topic CBSubs Mailer - date math in conditional
Excellent suggestion - hadn't thought of a code field.
Thanks,
Fred

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.180 seconds

Facebook Twitter LinkedIn