Import Users - Add Subscription on Import?

17 replies [Last post]
athleticmindedt...
Offline
Joined: 05/20/2010
Status: 
Answered

Hi,
I'm importing users via csv and was wondering if there is a way to add subscriptions to users somehow.

I know I can do it manually one at a time.

Is there a way to import users via csv and add subscriptions?

Leighton Whiting
Online
Joined: 06/02/2009
Jon, Depending on the script

Jon,
Depending on the script you are using to import the users, you could utilize the Membership Suite API to add memberships to the users once they have been created. It really depends on how you are importing them, and if you are willing to write some code.

To get a look at how to add a membership to a user, you can look at the ms_membership_user_admin_form_submit() function in ms_membership.module.

Sincerely,
Leighton Whiting

Abilnet
Offline
Joined: 12/07/2009
+1 for this... could be an

+1 for this... could be an useful feature to have in MS MembershipSuite.

athleticmindedt...
Offline
Joined: 05/20/2010
Thanks for the response! I'm

Thanks for the response! I'm somewhat new to Drupal but not php - and I don't mind hacking around with scripts.

So you are suggesting that I create a page which includes this form Or a page that will run this function X number of times based on data I provide?

Can you provide any details to hack a page this like? Or any documentation on how to create a page that can include a module form in this manner?

I guessing that the best way would be to include the form and a user text box which a user can paste multiple usernames or userids - on form submit it would get parsed and for each user the function ms_membership_user_admin_form_submit() gets run...

Leighton Whiting
Online
Joined: 06/02/2009
John, Exactly, you could

John,
Exactly, you could create a custom module to import the users in bulk (you should ideally have a unique email address for each user, not just a username). And instead of calling that MS function, I would only use the parts of it that you need. That function was an example of how to add a membership to a newly created user.

@Abilnet - I don't think that Bulk User creation is something that Membership Suite should handle. I could create some API calls that can be used to make this process easier, something like ms_membership_add_membership_to_user($uid, $membership_plan_id)

Sincerely,
Leighton Whiting

Abilnet
Offline
Joined: 12/07/2009
Thanks Leighton, I'm not a

Thanks Leighton,

I'm not a coder, but I suppose User Import could be used to mass import and somehow Membership Suite then takes control of the imported users & roles?

Leighton Whiting
Online
Joined: 06/02/2009
Abilnet, User Import is a

Abilnet,
User Import is a good solution, and I would be willing to write an .inc file which utilizes their API to provide support for Adding Memberships to newly imported users.

Sincerely,
Leighton Whiting

Abilnet
Offline
Joined: 12/07/2009
Hi Leighton, that's great,

Hi Leighton, that's great, appreciated!

athleticmindedt...
Offline
Joined: 05/20/2010
@WildKatana - that would be

@WildKatana - that would be fantastic if you could provide an .inc script to do this.

Can you let us know if this is something you are working on now?

athleticmindedt...
Offline
Joined: 05/20/2010
Though really, all we need is

Though really, all we need is a single page that list users with checkboxes and a MS Suite block underneath. You select the users config the membership.

Would this be hard to develop?

Abilnet
Offline
Joined: 12/07/2009
@jon.cianciullo Checkboxes to

@jon.cianciullo

Checkboxes to choose just some members manually on a block is fine... but what about having more numbers in the game? ...for example, I do have a client-base of more than 29.000 (yes, 29k) real people to offer a trial membership... too many checkboxes to tick, really wanting some automated solutions, please.

Leighton Whiting
Online
Joined: 06/02/2009
Abilnet, I have included the
Abilnet, I have included the functionality in the next version of Membership Suite, so no .inc file will be needed. I have made a screencast tutorial (I will be making many more of these in the future, this is the first one so I'm a bit nervous haha) that explains how it works:

User Import Tutorial from Leighton Whiting.

Sincerely, Leighton Whiting
athleticmindedt...
Offline
Joined: 05/20/2010
Great tutorial video!! When

Great tutorial video!!

When will the new version be released?

Abilnet
Offline
Joined: 12/07/2009
Once again, what a great

Once again, what a great support & attitude from Leighton, thanks so much, appreciated!

Leighton Whiting
Online
Joined: 06/02/2009
Sorry it cut off early, I had

Sorry it cut off early, I had to go fix the [customerToken] to use the username by default if there is not order associated with the membership.

Glad you liked the video, it's my first shot at doing a screencast, so I was a bit nervous lol. I'll be doing a lot more of these though for tutorials and showcasing new features in the future.

The new version should be out either this Friday night or Monday. I am moving on Saturday, so I won't be as available this weekend as usual ;)

Sincerely,
Leighton Whiting

athleticmindedt...
Offline
Joined: 05/20/2010
When will this user import

When will this user import feature be released? I thought it already was a few weeks back and I need it today!

Leighton Whiting
Online
Joined: 06/02/2009
Forgot to mention, but Jon

Forgot to mention, but Jon contacted me and I sent him the code needed for the Import Users since he needed it right away. I will be releasing Membership Suite 6.9 tonight (finally!) so this shouldn't be an issue anymore.

Sincerely,
Leighton Whiting

athleticmindedt...
Offline
Joined: 05/20/2010
The user import script I was

The user import script I was sent worked perfectly! Big thanks to WK for the great work.

Twitter Feed