Forcing Calendar Year Expirations with SQL Action Integration

9 years 2 months ago #258568 by delliott
I need to have CBSubs enforce memberships on a calendar year basis. My thought is perhaps I can achieve this via using a SQL Action Integration that fires upon activation or renewal of the membership.

I have this:

UPDATE `#__cbsubs_subscriptions`
SET `expiry_date` = if(month(now())<11, str_to_date(concat(year(now())+1,'-01-01'),'%Y-%m-%d'), str_to_date(concat(year(now())+2,'-01-01'),'%Y-%m-%d'))
WHERE `id` = [subscription_id];

Will this work? I know it produces the right date, but my concerns are can I modify the column expiry_date on the cbsubs_subscriptions table successfully at this point in the process or activation or renewal?

Please Log in to join the conversation.

9 years 2 months ago #258574 by nant

delliott wrote: I need to have CBSubs enforce memberships on a calendar year basis. My thought is perhaps I can achieve this via using a SQL Action Integration that fires upon activation or renewal of the membership.

I have this:

UPDATE `#__cbsubs_subscriptions`
SET `expiry_date` = if(month(now())<11, str_to_date(concat(year(now())+1,'-01-01'),'%Y-%m-%d'), str_to_date(concat(year(now())+2,'-01-01'),'%Y-%m-%d'))
WHERE `id` = [subscription_id];

Will this work? I know it produces the right date, but my concerns are can I modify the column expiry_date on the cbsubs_subscriptions table successfully at this point in the process or activation or renewal?


CBSubs already supports calendar based durations.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.250 seconds

Facebook Twitter LinkedIn