There are many reasons one might want to export the WordPress users and import them to another install. In my case, I needed to recreate a hacked website. I wanted to take all the content and migrate it without doing a full database restore for a database which might contain who-knows-what kind of evil hacker doo-doo.
What about exporting data from WPMU Dev’s Membership Pro plugin?
While an amazing premium tool, it lacks any kind of export functionality (As of May 7, 2015). This is a bummer, and during the last two days of hair pulling I have considered starting a petition to WPMU DEV to remove PRO from the plugin name. (All in all it is an awesome and useful plugin, about which I have never had reason to complain, until now.) What premium “pro” plugin does not come with the capability to export? Especially one that is so intrinsically tied into so many areas of the site, user data, subscriptions, permission, the list goes on… If you need to move your users or data their support approach is simple: “If you want something done, you have to do it yourself.”
For the main content, WordPress has a handy import/export tool built right in so in a flash all the posts and custom post types, categories, tag and taxonomies can be moved. BUT remember, you have to move them into a blank install, it will not overwrite existing content.
ALERT! The following instructions are for advanced (and adventurous) WordPress users, and will be a dive in to the mySql database via phpMyadmin.
Prep your tools and login details:
First, make sure you have a good backup plugin and download your backups. The chances of really screwing things up are pretty high and you may need to reset your WordPress install. I recommend Updraft Plus, it has saved my butt so many times where Vaultpress and Backupbuddy failed.
You will need to log in to the phpMyadmin interface for both of the accounts.
You will need a good text editor with search and replace.
To get started go to the originating database and click the database name, now click ‘export.’
In the export box ctrl click to select the following database tables:
These tables may have a different prefix, for example: my_usermeta, but the last part will always be the same, usermeta, user etc.
Now if you are going to be migrating the Membership Pro data you will need to select 14 more tables, they all have an m_ in them:
Once the tables are selected, under Structure, check the box for ‘Add DROP TABLE.’ This will make sure that when you import it into the new site, if any data is already present, it will be dropped and not interfere with the import.
At the bottom right click GO. Copy the sql data out of the window.
If you have a lot of data it is probably wise to check: ‘Save as file’ and zip it and then GO.
Now, open your text editor and past the sql data in, or unzip the sql file first.
Look at the database for the destination site and check the table prefix. If the table prefix is exactly the same, you are in luck, you don’t need to do anything. Save the file as ‘some-name-that-makes-sense.sql’
If your table prefixes are different then use the search and replace tool in your text editor to change them all to match the destination database table prefix. For example: wp_users might need to become: wp_my_users and so on… automate it. The imperative thing is that every single database table reference has the correct prefix.
Search and replace will take a while if you have a large set of users.
When it is done, save it as: “some-name-that-makes-sense.sql” and zip it.
If you are going to be migrating the Membership Pro users and data, make sure the plugin is installed and active before you go to the next step.
Head over to the destination database, phpMyadmin, and click the name of the database, then click import. Browse to or drop your saved .sql in and hit go.
All your users will be imported to the new site; all your Membership Pro data will be in the plugin.
ps: If it doesn’t work, restore from backup, start again.