Mass Assignment of Memberships to Existing Users

7 replies [Last post]
brandon
Offline
Joined: 12/08/2010
Status: 
Answered

(Apologies for another forum topic, but I did not find this answer in the site's search)

I understand that it is possible to utilize the user import to establish memberships. However, how can I assign memberships to my entire preexisting User list?

I imported the User list before I came across your module, but cannot find an option that allows me to give any preexisting users active membership status. If you can point me in the right direction, it would be greatly appreciated.

Best,

-BTC

Leighton Whiting
Offline
Joined: 06/02/2009
Brandon, You can add

Brandon,

You can add memberships to existing users individually, but not en masse. To add a membership to an individual existing user, just go to www.example.com/admin/user/ms_memberships/add

Depending on how many members you have, it may be faster to code up a solution to add the membership to all users. If so, you can use the API function in Membership Suite to do so. Here is an example snippet:

  1. $m_plan = ms_membership_load_membership_plan(1); // 1 is the id of the membership plan you are using. Enter whatever that number is
  2.  
  3. $result = db_query("SELECT * FROM {users} WHERE uid != %d", 0);
  4.  
  5. while ($account = db_fetch_object($result)) {
  6.   ms_membership_insert_new_membership($m_plan, $account);
  7. }

Sincerely,
Leighton Whiting

brandon
Offline
Joined: 12/08/2010
Okay - so I used User Import

Okay - so I used User Import to bring in my user list. I did everything your video tutorial said to do (not that it was that hard to follow) and I received a long list of this error that probably showed itself about 100 times on the page:

warning: Invalid argument supplied for foreach() in /home1/obtsorg/public_html/sites/all/modules/moneyscripts/ms_membership/ms_membership.module on line 4167.

It still said my users were imported. I checked my user list and sure enough, they're all in there.

I went and checked my memberships and not one of them had their membership activated upon import. Any ideas here? I'd hate to have to do these one by one if the user import option is right there.

Anstr
Offline
Joined: 01/01/2011
Me Too

I also can't make User Import work. I get the same error message -- line 4167.

Does User Import work?

If it doesn't, then the option to add the same membership to all current accounts is not good for me. We have some one year memberships and some two year memberships.

Anstr Davidson

Leighton Whiting
Offline
Joined: 06/02/2009
The User Import module has

The User Import module has been a big headache so far. It seems like they keep changing their API so the support keeps breaking once we get it to work. What version of User Import are you using, and can you send me a sample of your .csv file (you can change the info to bogus info)?

Sincerely,
Leighton Whiting

Anstr
Offline
Joined: 01/01/2011
Using version 6.x-2.4 of User

Using version 6.x-2.4 of User Import. A line of the csv file is below, but the data gets imported fine. It's the membership that doesn't work.

If User Import doesn't work, is there any other way to assign membership to many current user accounts (or to imported user accounts)? (I have figured out, I think, a clunky way around this, but I really don't want to do it. I have about 400 current members who need to get memberships.)

Sample line of csv file:

"Blow","Joe",337,"M","Sue",69,06/22/55,"16 Elm St.","Town","MT",11102,"555-123-4567","555-765-4321","email@email.com",2011,"HT20101224-40559",11/22/07,,"Renewal-VOL"," - Renew 12/24/010 - xVOL: BRR - Wil Smith "

Leighton Whiting
Offline
Joined: 06/02/2009
I've added a new feature that

I've added a new feature that will allow you to add and remove memberships to users in bulk on the Admin->Users page. See screenshot.

Sincerely,
Leighton Whiting

AttachmentSize
add_bulk_users.jpg 130.66 KB
Anstr
Offline
Joined: 01/01/2011
That looks great. I can't,

That looks great. I can't, however, make it work. I don't see the options to add or delete memberships in the "Update Options" pick list. (That's on the page: /admin/user/user right?) I have applied the update and now have MoneyScripts 6.x-6.17 and Drupal 6.20. I am probably doing something wrong.

Twitter Feed