[SOLVED] CBSubs Report Functionality

14 years 2 months ago #123109 by Robert_ITMan
Replied by Robert_ITMan on topic Re:CBSubs Report Functionality
Thank you that is a good work around - very helpful - appreciate your quick reply too!

Please Log in to join the conversation.

13 years 5 months ago #144436 by ekaln
Replied by ekaln on topic Re:CBSubs Report Functionality
Hi krileon

Thanks indeed. This query was really, really helpful.

Can I be cheeky? Is it possible to get the subscription plan name in the results, in addition to the plan's ID#?

Post edited by: ekaln, at: 2010/10/20 16:19

Please Log in to join the conversation.

13 years 5 months ago #144456 by krileon
Replied by krileon on topic Re:CBSubs Report Functionality

Can I be cheeky? Is it possible to get the subscription plan name in the results, in addition to the plan's ID#?

Certainly, please see the below query.

Only active subscriptions:
[code:1]
SELECT a.`id` AS ID
, a.`name` AS Name
, a.`username` AS Username
, a.`email` AS Email
, c.`plan_id` AS Subscription
, d.`name` AS Plan
, c.`subscription_date` AS Subscribed
, c.`last_renewed_date` AS Renewed
, c.`expiry_date` AS Expires
FROM `jos_users` AS a
INNER JOIN `jos_comprofiler` AS b
ON b.`user_id` = a.`id`
INNER JOIN `jos_cbsubs_subscriptions` AS c
ON c.`user_id` = b.`user_id`
INNER JOIN `jos_cbsubs_plans` AS d
ON d.`id` = c.`plan_id`
WHERE a.`block` = 0
AND b.`confirmed` = 1
AND b.`approved` = 1
AND b.`banned` = 0
AND c.`status` = 'A'
[/code:1]

All subscriptions with status as text:
[code:1]
SELECT a.`id` AS ID
, a.`name` AS Name
, a.`username` AS Username
, a.`email` AS Email
, ( CASE c.`status` WHEN 'A' THEN 'Active' WHEN 'R' THEN 'Unpaid' WHEN 'X' THEN 'Expired' WHEN 'C' THEN 'Unsubscribed' WHEN 'U' THEN 'Upgrade' WHEN 'I' THEN 'Invalid' ELSE 'Unknown' END ) AS Status
, c.`plan_id` AS Subscription
, d.`name` AS Plan
, c.`subscription_date` AS Subscribed
, c.`last_renewed_date` AS Renewed
, c.`expiry_date` AS Expires
FROM `jos_users` AS a
INNER JOIN `jos_comprofiler` AS b
ON b.`user_id` = a.`id`
INNER JOIN `jos_cbsubs_subscriptions` AS c
ON c.`user_id` = b.`user_id`
INNER JOIN `jos_cbsubs_plans` AS d
ON d.`id` = c.`plan_id`
WHERE a.`block` = 0
AND b.`confirmed` = 1
AND b.`approved` = 1
AND b.`banned` = 0
[/code:1]


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.

13 years 5 months ago #144468 by ekaln
Replied by ekaln on topic Re:CBSubs Report Functionality
Kyle - that's an ENORMOUS help, thank you indeed!

Will save me about 30 minutes every single week.

Please Log in to join the conversation.

12 years 4 months ago #182325 by waynejb
Replied by waynejb on topic Re:CBSubs Report Functionality
Where is this "We've already got a feature ticket in place to allow CSV export of subscriptions" Is this a feature already installed or where can you find this option?

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.235 seconds

Facebook Twitter LinkedIn