Skip to Content Skip to Menu

Limit amount of subscriptions on a plan?

  • rbuelund
  • rbuelund
  • OFFLINE
  • Posts: 565
  • Thanks: 40
  • Karma: 4
3 years 8 months ago #323230 by rbuelund
Is it possible to limit the number of subscriptions on a plan, eg. when a total of 100 registrations with this subsciption plan is made, then it is no longer possible to register/subscipe ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
3 years 8 months ago #323243 by krileon
Replied by krileon on topic Limit amount of subscriptions on a plan?
There's no customer limit parameter for plans. Only way I can think of to do this is probably conditions with help of CB Query Field or use CBSubs SQL Actions to change the plans parameters so it doesn't allow new purchases once a number of users have subscribed using SQL. The below for example should work.

SQL Action 1
Activation:
Code:
UPDATE `#__cbsubs_plans` AS p SET p.`allow_newsubscriptions` = 0, p.`allow_registration` = 0, p.`allow_upgrade_to_this` = 0 WHERE p.`id` = '[plan_id]' AND ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS s WHERE s.`plan_id` = p.`id` ) >= 100

That should turn off "Allow new subscriptions" under the Access tab and turn off "Allow registration" and "Allow upgrade to this" under the Workflows tab if the plan has 100 or more subscribers. It does not check if they are active subscribers. It's just checking if a subscription row exists for the plan. Adjust the 100 in the query to whatever you like.


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum