[SOLVED] CB Subs - setting a maximum number of subscription

11 years 7 months ago - 11 years 7 months ago #210785 by ecarne
Is there a way to set the a maximum number of subscriptions for a given plan?
We offer site access coupled with a live event. So we would like to cap registrations for each plan at 30 to 50. Is that possible

Please Log in to join the conversation.

11 years 7 months ago #210893 by krileon
I don't think you can. I believe you can only limit the number of times someone can renew to the same plan, but no feature to limit how many times the plan can be used; believe this feature is planned for a later release though as it'd seam like a pretty cool usecase. I suppose for now you can use CBSubs SQL Actions to accomplish this using the below query.
UPDATE `#__cbsubs_plans` SET `allow_newsubscriptions` = 0 WHERE `id` = '[plan_id]' AND ( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` WHERE `plan_id` = '[plan_id]' ) + 1 ) >= 50

Please ensure the above is tested thoroughly to provide what you're wanting. Change 50 to whatever value you want to limit it to. What it does is after a user subscribes it counts already existing subscriptions and increments by 1 then compares it to your limit. If it's at limit it sets the new subscriptions parameter to 0, which disables new subscriptions to that plan.


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.

11 years 7 months ago #210909 by erilam
I think it will also be necessary to be attentive to the renewals because if you set cbsubs to let a time to renewal for your members, the total number of subscription will be less than your limit for a moment.

Eric Lamy (erix)
www.agerix.fr/

Please Log in to join the conversation.

11 years 7 months ago #210910 by nant

erilam wrote: I think it will also be necessary to be attentive to the renewals because if you set cbsubs to let a time to renewal for your members, the total number of subscription will be less than your limit for a moment.


First idea that pops up here is to use an SQL script to unpublish the plan if it has reached the desired number of subscribers.

It could be a CBSUbs SQL actions script. Kyle would have to elaborate if this is doable.

Please Log in to join the conversation.

11 years 7 months ago #211005 by krileon
Just update the already provided SQL in my above reply to exclude renewals. Check for a status of "A" to only count active subscriptions.


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

Please Log in to join the conversation.

11 years 7 months ago #211012 by erilam

krileon wrote: Just update the already provided SQL in my above reply to exclude renewals. Check for a status of "A" to only count active subscriptions.


Cool we are agree now ;)

Eric Lamy (erix)
www.agerix.fr/

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.247 seconds

Facebook Twitter LinkedIn