CB Lists and CBSubs

4 weeks 1 day ago #332202 by rbuelund
CB Lists and CBSubs was created by rbuelund
I need to make a user list with some user fields data and it needs to be filtered based on status of an attached CBSubs plan - how would I do that?

Please Log in to join the conversation.

4 weeks 1 day ago #332208 by krileon
Replied by krileon on topic CB Lists and CBSubs
You can filter a userlist based off subscription using the below Advanced Filter usage.

Active
( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'A' ) >= 1 )

Expired
( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'X' ) >= 1 )

This isn't filtered to a specific plan. If you only want to show from a specific plan you'd use the below for example.

Active
( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'A' AND sub.`plan_id` = PLAN_ID_HERE ) >= 1 )

Expired
( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'X' AND sub.`plan_id` = PLAN_ID_HERE ) >= 1 )

Be sure to replace PLAN_ID_HERE with your actual plan id.


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.

4 weeks 1 day ago #332216 by rbuelund
Replied by rbuelund on topic CB Lists and CBSubs
Thank you

Please Log in to join the conversation.

1 week 22 hours ago #332567 by rbuelund
Replied by rbuelund on topic CB Lists and CBSubs
I have now run into a problem with the above solution. I have users which have an old inactive (status = X) plan attached, and then a new active plan attached (status =A) then theese users are shown on both lists! ? How can I avoid this? Do I have to delete the old subscription rows in the database - would that work, or is that gonna break the whole thing ?

Please Log in to join the conversation.

1 week 3 hours ago #332575 by krileon
Replied by krileon on topic CB Lists and CBSubs
On your expired list add an AND statement to filter out those with expired and active subscriptions. Example as follows using the above examples.

Expired with No Active
( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'X' ) >= 1 ) AND ( ( SELECT COUNT(*) FROM `#__cbsubs_subscriptions` AS sub WHERE sub.`user_id` = u.`id` AND sub.`status` = 'A' ) = 0 )


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.

Moderators: beatnantkrileon
Time to create page: 0.184 seconds