Please Log in or Create an account to join the conversation.
PresidenteMensaMexico wrote: Hi,
I need to offer a free subscription to underage members. I first thought about making it a promotion that would check their birthday and apply it only if they where underage but that requires them to renew their subscription every time it expires.
So I was thinking about a new plan for underage, but how can I specify the expiration date to their 18th birthday?
Thanks for your help
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
PresidenteMensaMexico wrote: Awesome, I almost have it, except when I set "cbsubs_subscriptions expiry_date" all subscriptions expiry dates are modified, even a subscription that was unsubscribed when subscribing to the new plan is set to Unsubscribed on "modified date". How can I modify only the child subscription and not the parent one or any other?
Sorry solved it. Added the "WHERE plan id =" part.
Thanks again.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
PresidenteMensaMexico wrote: Sure
I created a new plan that expires 5 minutes after being activated.
Then in the Integrations tab you go into the SQL actions subtab and this is where you need to configure SQL actions.
The code I used is this:
UPDATE #__cbsubs_subscriptions SET expiry_date = date_add('[cb_mensanacimiento]', interval 18 year) WHERE (plan_id='11' and user_id =[user_id]);
I setup a cb field named cb:mensanacimiento where I save the birthdate when a new user registers. This code sets the expiry date of the plan with id 11 for the current user to their birthdate plus 18 years, (that is legal age in Mexico).
Be careful to include the plan_id and user_id with the WHERE command or else all the values for expiry date of your table will get rewritten for all users and all plans.
You need to post the code both in the Activation and Renewal part of an SQL action for it to work on both cases. Check the radio button to execute internally.
And voila, whenever you assign a new user to this plan, the expiration date of its membership will automatically be rewritten to 18 years after his birthdate.
Please Log in or Create an account to join the conversation.