[SOLVED] delimiter date if statement

12 years 2 months ago - 12 years 2 months ago #193063 by tgribble
[SOLVED] delimiter date if statement was created by tgribble
hello

is there a simple way to add the following to a delimiter field?

[cb:if CURDATE() > cb_memberexp] YOUR MEMBERSHIP HAS EXPIRED [/cb:if]

i am trying to do the obvious here, but just cant seem to get it to work?

thanks

Please Log in to join the conversation.

12 years 2 months ago #193156 by nant
The following user(s) said Thank You: tgribble

Please Log in to join the conversation.

12 years 2 months ago #193157 by nant
Replied by nant on topic Re: delimiter date if statement
BTW - if you need better support then consider upgrading your membership.
The following user(s) said Thank You: tgribble

Please Log in to join the conversation.

12 years 2 months ago - 12 years 2 months ago #193169 by tgribble
Replied by tgribble on topic Re: delimiter date if statement
hi again and thanks everso much for the help, i just cannot seemto make it work.

using your reply, would this work, because it doesnt seem to...

[cb:if [cb:date format="Y-m-d" /] > cb_memberexp] YOUR MEMBERSHIP HAS EXPIRED [/cb:if]

i have tried all sort of permutations, it just doesnt seem to come together to do the comparison between the dates

sorry for the hassle, but are you able to give me some clues i would really appreciate it.

thanks

Please Log in to join the conversation.

12 years 2 months ago - 12 years 2 months ago #193242 by tgribble
Replied by tgribble on topic Re: delimiter date if statement
i have tried all these cb:if and these are the results

anyone who can help please. i feel i am close, but just cant crack it

thanks

cb:if

last visit date [lastvisitdate]

member exp [cb_memberexp]

today [cb:date format="Y-m-d" /]

1[cb:if cb_memberexp < "2012-12-31" ] EXPIRED [/cb:if] membership < 2012-12-31

2[cb:if cb_memberexp < lastvisitdate ] EXPIRED [/cb:if] membership < lastvisitdate

3[cb:if lastvisitdate < "2012-12-31" ] EXPIRED [/cb:if] lastvisitdate < 2012-12-31

4[cb:if cb_memberexp < [cb:date format="Y-m-d" /] ] EXPIRED [/cb:if] membership < today

5[cb:if [cb:date format="Y-m-d" /] < "2012-12-31" ] EXPIRED [/cb:if] today < 2012-12-31




results

last visit date 2012-03-04

member exp 2012-01-31

today 2012-03-05

1 EXPIRED membership < 2012-12-31

2 membership < lastvisitdate

3 EXPIRED lastvisitdate < 2012-12-31

4 membership < today

5 today < 2012-12-31

Please Log in to join the conversation.

12 years 2 months ago #193587 by krileon
Replied by krileon on topic Re: delimiter date if statement
You can't use substitutions inside of substitutions. To have what you're wanting you'll need to use a CB Query Field to calculate the date difference of your field to NOW() then output a 1 if it's greater and a 0 if it's not. Then in your IF statement you'd compare against that CB Query Field. Below is an example query and IF statement of this usage.

Title: cb_subscribed
Query:
SELECT IF( DATEDIFF( `cb_memberexp`, NOW() ) <= 0, 0, 1 ) FROM `#__comprofiler` WHERE `id` = '[user_id]'

The above takes the difference in days between cb_memberexp and current datetime. It then checks if that value is less then or equal to 0 meaning expired. If it is expired it returns a 0 and if it's not it returns a 1. You could then use the above CB Query Field in the below IF statement.

[cb:if cb_subscribed="0" ]EXPIRED[/cb:if]


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

Facebook Twitter LinkedIn