Skip to Content Skip to Menu

Using substitutions to display message based on pending expiry date

15 hours 55 minutes ago #340165 by wintercorn
I need to show a message to members whose expiry is within 30 days of today.

I can't even work out the logic for this and ended up with this which can't be right. What's the right syntax for the less than 30 days section?

[cbsubs:if user="#displayed" plan="4" status="A" and  "expiry_date"  <30 ]MESSAGE GOES HERE[/cbsubs:if]

Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48749
  • Thanks: 8326
  • Karma: 1448
14 hours 51 minutes ago #340168 by krileon
You'll need to use the "since" feature of the CBSubs substitutions. Edit the cbpaidsubsbot in System > Manage > Plugins and review its description for a more detailed explanation of CBSubs content plugin substitutions. With that said I believe the below should work.
Code:
[cbsubs:if user="#displayed" plan="4" status="A" since>="-30 DAYS" date="expiry"]CONTENT[/cbsubs:if]

You may need to adjust the operator on "since" to <= though, but give that a try first. Effectively the way it works is it modifies the expiration date by subtracting 30 days from it then compares it to the current datetime. So if the expiration date -30 days is >= to the current date then they're not about to expire in 30 days is effectively what the conditioning is saying.


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

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

13 hours 26 minutes ago #340174 by wintercorn
Works a treat. Thanks.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum