CBSubs Mailer conditions - datetime + duration

1 month 2 weeks ago #337538 by fdinkler
Hey Kyle - struggling with Mailer conditions to achieve the following filter
   Select Users with "Expiry date of user subscriptions above" that are between two date/times (or optionally exactly match a single date)

Equal to the User Management search options for CBSubs, noting that the dates are defined by duration from current date (30 days
  1. Any active plan,
  2. Expiry date is after 04/13/2024 12:00 am, (30 days in the future from today) 
  3. and Expiry date is before 04/14/2024 12:00 am  (31 days in the future from today) 

I don't find anything in substitutions tutorial about creating a substitution string representing a future date as an offset from today - 
e.g. [cb:date format="PHP_DATE()_FORMAT" date="DATETIME + 30d" /]

Suggestions?
Thanks
Fred

Please Log in to join the conversation.

1 month 2 weeks ago #337542 by krileon
Is it not possible to get the exact recipients using "Main Mailer Triggering Conditions" since you can specify before/after date ranges there directly? Probably something like the following.

Automatically send message starting at: 1 month before
Relative to this date: Subscription's Expiry Date
But do not send message if it's later than: 1 month after

I don't find anything in substitutions tutorial about creating a substitution string representing a future date as an offset from today -
e.g. [cb:date format="PHP_DATE()_FORMAT" date="DATETIME + 30d" /]

Such a substitution doesn't exist. You'll have to use the built in +/- date conditions in the condition dropdown to modify a date.


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.

1 month 2 weeks ago #337544 by fdinkler
Replied by fdinkler on topic CBSubs Mailer conditions - datetime + duration
Kyle - 
USE CASE

Data:
User A  subscription expires  04/01/2024
User B  subscription expires  04/01/2024
User C  subscription expires  04/02/2024
User D  subscription expires  04/02/2024
User E  subscription expires  04/02/2024
User F  subscription expires  04/03/2024
User G  subscription expires  04/03/2024

Goals:  
Send expiration notice email to users that will expire one month from the current date
Send only one email notice per user within 11 months

Config:
Automatically send message starting at: 1 month before
Relative to this date: Subscription's Expiry Date
But do not send message if it's later than: 1 month after
cron job to trigger process rules URL once a day at 23:58
cron job to process mail queue once a day at 00:01

Execute:
Trigger URL to process mailers rules on 03/02/2024
     Desired results:  Queue contains Users C, D, E
     Actual results:  Queue contains Users A, B, C, D, E

What config setting can prevent Users A and B from getting into the queue?  
or from being sent? -   But do not send message if it's later than: 1 day after   ?
What happens to emails in the send queue that aren't sent?

Thanks,
Fred

Please Log in to join the conversation.

1 month 2 weeks ago - 1 month 2 weeks ago #337547 by krileon
Ok, so you want it to be 30 days before/after expiration date AND if their expiration date is 30 days before/after the date the mailer was processed? That's doable. Keep your current configuration then add the following 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: [cb:date format="Y-m-d H:i:s" /]
Condition 1 (> for Dates): For dates: Date A > Date B - 30 days (Date A must be later than 30 days before Date B )

I believe that should allow any subscription with an expiration date within 30 days of datetime of the mailer processing. I can't be completely sure this will work though.

I don't fully understand why the need for the condition though. You can control whom should be emailed using the before/after parameters.

What config setting can prevent Users A and B from getting into the queue?
or from being sent? - But do not send message if it's later than: 1 day after ?

I don't know. I don't understand what you're trying to accomplish exactly. If it's meant to email them before they expire then don't set an after parameter or yes set it to just 1 day. If it's supposed to be "you're expiring soon!" notification then the below is probably ideal.

Automatically send message starting at: 1 month before
Relative to this date: Subscription's Expiry Date
Must be in state: Active
But do not send message if it's later than: And no other date condition

What happens to emails in the send queue that aren't sent?

Nothing. They just sit there until the sending queue is processed.


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

Facebook Twitter LinkedIn