This process has been simplified through our Import Users from CSV Add On which works alongside the general Import From CSV WordPress plugin. It still may be helpful to read the notes below to get an idea of how the import works to add members.

Banner for Advanced Code Recipe Tutorial for Paid Memberships Pro

This is an oft-requested feature, and we’ve written an Add On to facilitate Member Import. The steps below were written prior to that Add On and document a manual method that interacts directly with your database.

  • Step 1: I suppose is setting up your membership levels using the plugin. It will help to know what levels you have in advance.
  • Step 2: Setup a CSV file with your users name, email address, and other meta data. Use a plugin like (Import Users from CSV) or (User Meta) to import the users into WordPress. Possibly use a meta field to differentiate membership levels for each user if you have more than one membership level or a combination of non-member and member users.
  • I haven’t personally used either of these plugins. I would test these out and any other that come up for “import users” in the WP repository.
  • Step 3: Add users to a membership level. This can be done in bulk by running queries on your database. Use phpMyAdmin or MySQL to run queries like this: (backup the DB, and make sure you alter these to work on your site)
  • #add all users to level with id 1
  • INSERT IGNORE INTO wp_pmpro_memberships_users (user_id, membership_id, startdate) SELECT ID, ’1′, now() FROM wp_users
  • #add users with a meta field of membership_level set to whatever id is in that field
  • INSERT IGNORE INTO wp_pmpro_memberships_users (user_id, membership_id, startdate) SELECT user_id, meta_value, now() FROM wp_usermeta WHERE meta_key = ‘membership_level’

And some more:

  • To add end dates to the memberships you import:
  • (1) make sure you add a “membership_enddate” meta field to the users with the format YYYY-MM-DD. You should be able to add a column to your import CSV and import it via those plugins.
  • (2) Run this query AFTER you run the earlier ones to insert the membership levels.
  • UPDATE wp_pmpro_memberships_users mu, wp_usermeta um SET mu.enddate = um.meta_value WHERE mu.user_id = um.user_id AND um.meta_key = ‘membership_enddate’
  • That should do it.
  • Check out these MySQL docs with explanations on how I came up with those queries. Again, I didn’t test them.
  • This post did an INSERT … SELECT to insert items into the membership table using values from the usermeta table.
  • This post does an UPDATE JOIN to update two tables at once… or really we update the one table using values from the other.

And some more:

Ok, by email, you asked me how to then send all these new users a notification email. This code should work. This is untested. Please backup the DB and code before running this. And be sure to test it on a smaller # of users by tweaking the $user_ids array.

Adding the recipe to your website

You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

And finally, a nice testimonial

from PMPro member HarnessTech that includes from info on how he did his export/import:

I just had to stop by and say how wonderful this thread is. I used AMR Users on my old site to export my existing users, then I tweaked the CSV as needed and made the levels and end date modifications as suggested above. Then I imported into the new site using User Meta Pro (VERY awesome plugin) and used the MySQL calls above to get things in order. Incredible!

Note that I have 844 members.

Thank you, Jason, for a great product and excellent customer support.