Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] How do I check if the 'next year' appears in an autoaction?

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
8 years 7 months ago - 8 years 6 months ago #279551 by fribse2011
I wish to check if 'next year' does not appear in a field in an autoaction.

I can see I can use the:
[cb:parse function="time"][cb:date format="Y" /][/cb:parse]
to get the current year in a filter.
Is it then just make a filter like this
[cb_year] DOES NOT CONTAIN [cb:parse function="time" time="+1 YEAR"][cb:date format="Y" /][/cb:parse]
?

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.
Last edit: 8 years 6 months ago by krileon.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279586 by krileon
The time function is just strtotime. With the time parameter it's the same as doing the following.

Code:
strtotime( '+1 YEAR', TIMESTAMP_HERE )

Without the time parameter it's the same as doing the following.

Code:
strtotime( DATETIME_HERE )

None of this is relevant if your year field is not actually a date or datetime string as it can't be properly parsed by strtotime. If it's simply 2016 for example you'll need to use the math format function to add 1.

Aside from that you'll need to provide sample values you expect cb_year to be set to in addition to an example of what you're trying to accomplish for me to suggest anything further.


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.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
8 years 7 months ago #279646 by fribse2011
Hi Kyle

Ok, the field I'm checking against is just a multicheck field that I've entered the following in:
2012
2013
2014
2015
2016
2017
2018
2019
2020

Then we just tick of for the years paid.

So when we receive payment for 2017, we just tick of 2017, and then in november we check if it's ticked, and if it's not, we activate the 'reminder' flag, which then in turn triggers them to be added to an acymailing list.

I'm currently doing this with an external sql script, but would very muck like to move it 'inside' joomla.

I could also change it, so that we just have a flag that marks if 'next year' is paid, and we clear that in august or something like that, and then set it again when payment is received, but it's nice to have the 'history'.

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279678 by krileon
I'm unsure why you need to increment it then. If in November you're checking if the current year is ticked you'd just do the following.

[cb_year] Does Not Contain [cb:date format="Y" /]

In the above case you'd send a reminder or do whatever behavior you need for the reminder as it means the current year isn't checked. If you need the next year then the below will probably work.

[cb_year] Does Not Contain [cb:parse function="math"][cb:date format="Y" /] + 1[/cb:parse]


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.

  • fribse2011
  • fribse2011
  • OFFLINE
  • Posts: 921
  • Thanks: 79
  • Karma: 8
8 years 7 months ago - 8 years 7 months ago #279745 by fribse2011
I'm trying to test if it works.
So I click 'click here to execute' 'inside' the action, as I understand it, it will only run for the currently logged in user?
No matter if I tick 2017 in the multiselect for my user, I get added to the reminder list, so it seems to not work?

Is there a way I can get to see what the formula outputs?

Best regards
Fribse

Frømandsklubben Nikon, www.nikondyk.dk
We're a volunteer driven diving club in Ishøj, Denmark.
Har du brug for en dykkerklub der rummer alle, så kom ned til os.
Last edit: 8 years 7 months ago by fribse2011.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279778 by krileon
The execute button does not execute it on the current viewing user unless you've set User to User. Otherwise it's always going to be ran on an empty user object, which means the condition will always pass because cb_year will always be empty.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum