Skip to Content Skip to Menu

Using substitutions to display message based on pending expiry date

2 days 1 hour 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: 48760
  • Thanks: 8327
  • Karma: 1448
2 days 35 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.

1 day 23 hours 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.

1 day 6 hours ago #340179 by wintercorn
OK, I might be missing something here but how do I enable this to show across the site? It only works on the CB profile page at present. I can't see any settings to change but I'm sure there was a setting at one point.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48760
  • Thanks: 8327
  • Karma: 1448
1 day 1 hour ago #340183 by krileon
It works anywhere Joomla content plugins work. So you can only use it in such locations. For example in Joomla articles or in CB Content Module if the content plugins parameter is enabled or Custom HTML field if content plugins parameter is enabled.


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.

1 day 58 minutes ago #340186 by wintercorn
Sorry but I can't get it displayed anywhere but the CB profile page. Example - the privacy policy page is a standard Joomla article. Publishing the module to that page on the same position also doesn't show it.

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

Moderators: beatnantkrileon
Powered by Kunena Forum