Skip to Content Skip to Menu

[SOLVED] CB Subs: Import users with no subscription into subscription plan

  • 3by400Inc
  • 3by400Inc
  • OFFLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
10 years 4 months ago - 10 years 4 months ago #246352 by 3by400Inc
Joomla 2.5.22
CB 1.9.1
CB Subs 3.0.0

What is the easiest way to import about 4300 current site users with no subscription into a subscription plan? I reviewed the CB Subs Import function, but I'm only able to select users in a current subscription. Is it possible to choose the users with "NO PLAN ACTIVE" and import them into a free shopper subscription?

All users on the site, regardless of subscription plan, are in the "Registered" user group so choosing an ACL group wasn't going to work either, unfortunately.
Attachments:
Last edit: 10 years 4 months ago by 3by400Inc.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 4 months ago #246378 by krileon
Export their user ids using phpmyadmin as a comma separated list then use the simple import feature, which uses a comma separated list of user ids. Ensure you're only doing this for active users. Example query as follows to accomplish this.

Code:
SELECT GROUP_CONCAT( DISTINCT a.`id` SEPARATOR ',' ) FROM `jos_comprofiler` AS a INNER JOIN `jos_users` AS b ON b.`id` = a.`id` LEFT JOIN `jos_cbsubs_subscriptions` AS c ON c.`user_id` = a.`id` AND c.`id` IS NULL WHERE a.`approved` = 1 AND a.`confirmed` = 1 AND b.`block` = 0

The above should grab the user id of all confirmed, approved, and not blocked users that do not have a subscription row. If your database table prefix isn't jos_ be sure to change it in the above query.


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: 3by400Inc, pepperstreet

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

  • 3by400Inc
  • 3by400Inc
  • OFFLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
10 years 4 months ago - 10 years 4 months ago #246446 by 3by400Inc
This query doesn't seem to be quite right ... it selected users that do have an active subscription.

I attempted to import the file in a 'test run' and I've attached a screenshot of the error message.
Attachments:
Last edit: 10 years 4 months ago by 3by400Inc.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 4 months ago #246475 by krileon
The below should work, seams ok testing on phpmyadmin.

Code:
SELECT GROUP_CONCAT( DISTINCT a.`id` SEPARATOR ',' ) FROM `jos_comprofiler` AS a INNER JOIN `jos_users` AS b ON b.`id` = a.`id` LEFT JOIN `jos_cbsubs_subscriptions` AS c ON c.`user_id` = a.`id` WHERE a.`approved` = 1 AND a.`confirmed` = 1 AND b.`block` = 0 AND c.`id` IS NULL


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: 3by400Inc, pepperstreet

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

  • 3by400Inc
  • 3by400Inc
  • OFFLINE
  • Posts: 119
  • Thanks: 11
  • Karma: 0
10 years 4 months ago - 10 years 4 months ago #246485 by 3by400Inc
Ok, this query is selecting the correct user set ... however, there seems to be a limit within phpmyAdmin possibly because the query is only grabbing around 230 users out of an expected 4300.

Update

I think I need to set the group_concat_max_len value at the time of the query ...
Last edit: 10 years 4 months ago by 3by400Inc.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48479
  • Thanks: 8282
  • Karma: 1443
10 years 4 months ago #246488 by krileon
You may want to do it in batches of 50. Importing subscriptions for 4,300 users at once isn't going to work. To do this you'd add LIMIT 0 50, then LIMIT 50 100, etc.. until you've all your users. You could also grab the rows instead of concacting all their IDs then do a normal phpmyadmin export to CSV and format as needed using excel.


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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum