Finding users with no subscription

7 years 4 weeks ago #292366 by ksaltman
Finding users with no subscription was created by ksaltman
I need to determine what users do not have any active subscription including a Free Subscription.

I was stupid when first setting things up and made a free subscription but only for 1 year. I now have some users with no active subscription which is causing other issues with CBSubs.

What is the best way to create a list of users that have no active subscription? I can then manually subscribe them to the Free For Life subscription.

I assume I can create an auto action to do this automatically in the future but for now I need to clean up the accounts that have already expired my let's call it "Stupid Free For A Year" subscription.

Thanks!

Please Log in to join the conversation.

7 years 4 weeks ago #292372 by krileon
Replied by krileon on topic Finding users with no subscription
You could try filtering CB > User Management to all users who have an expired free subscription. You could also try using CBSubs > Import and importing those with an expired free subscription to your new free lifetime subscription (run it as simulation first to make sure the users it finds is correct). CB Auto Actions can act on plan status change using the below if you still want to go that route.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Equal To A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
1: [var3] Equal To PLAN_ID_HERE
2: [var2] Not Equal To A


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.

7 years 4 weeks ago #292385 by ksaltman
Replied by ksaltman on topic Finding users with no subscription
I know I can filter on a expired plan, but then need to take that list and pair it down to those that also (AND) don't have another active plan. If I look just for the expired free plan I have to go through each user individually to see if they have another active plan.

I'm not against creating the list using myPHPadmin but unsure what SELECT statement might yield the results I'm looking for. Is that possible?

Please Log in to join the conversation.

7 years 4 weeks ago #292405 by krileon
Replied by krileon on topic Finding users with no subscription

I'm not against creating the list using myPHPadmin but unsure what SELECT statement might yield the results I'm looking for. Is that possible?

Of course, you'd need to join the users and subscriptions table then filter accordingly. Simple example as follows.

SELECT s1.`id` AS subscription, u.*
FROM `jos_users` AS u
INNER JOIN `jos_cbsubs_subscriptions` AS s1
ON s1.`user_id` = u.`id`
AND s1.`plan_id` = PLAN_ID_HERE
LEFT JOIN `jos_cbsubs_subscriptions` AS s2
ON s2.`user_id` = u.`id`
AND s2.`status` = 'A'
AND s2.`plan_id` != PLAN_ID_HERE
WHERE s2.`id` IS NULL

That should give you a list of users that have a subscription to PLAN_ID_HERE of any kind (active, expired, etc..) and do not have an active subscription to any other plan. Note it's setup for phpmyadmin so replace jos_ with whatever your table prefix actually is.

The easiest solution though is to just edit your free plan, change it to free lifetime, then find all the users who have an active subscription to it and force renew them.


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.

7 years 4 weeks ago #292428 by ksaltman
Replied by ksaltman on topic Finding users with no subscription
Thanks, I'll see what this yields. By selecting the active users of the old "free 1 year" plan I'd have to force renew manually about 1,600 users. Not something I'd like to spend my time doing not to mention the huge potential for human error.

Anyway, those with the old 1 year free plan should be covered by the Auto Action when then expire and those that have already expired I'm thinking will be a manageable number to do manually.

As always thanks for the assist.

Please Log in to join the conversation.

7 years 4 weeks ago #292429 by ksaltman
Replied by ksaltman on topic Finding users with no subscription
Ok well done, the SQL statement has provided a randomly confirmed list of 109 accounts with the no subscription issue. Anyway to feed that into a batch process to renew them to the "new/modified" free for life subscription?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.183 seconds

Facebook Twitter LinkedIn