How to import/export users with OptimizeMember
With OptimizeMember, you can Import and Export your Users/Members information to a CSV file. You can use the Import/Export options for easy data backup purposes, or to make many changes to user/member information and then re-import those changes into OptimizeMember.
This guide will explain how to export and import user/member information.
The OptimizeMember Import/Export settings may be found under "OptimizeMember > Import/Export"
You'll notice there are 3 tabs there. We're only going to discuss the two related to User/Member Import/Export in this guide.
Click on the tab for "User/Member CSV Exportation" to expand the options. These options will allow you to download (export) a copy of all your membership site's user data (the same data you see when visiting "WordPress Dashboard > Users"
The default settings work just fine for most site owners and usually all you need to do is click Export Now to have OpitmizeMember generate the CSV file and then prompt you to download it.
The default option, Default (CSV...), is required if you want to re-import the CSV file into your OptimizeMember site. If you only want to download the information to view it, or to print it out, you may prefer the Easy-Read option, which exports the data in a format that is more human-readable.
If you run into an issue where the export file looks corrupted, please read our guide on how to fix this: https://optimizepress.zendesk.com/hc/en-us/articles/115003534947
Click on the tab for "User/Member CSV Importation" to expand the options. This area allows us to upload an existing CSV file that contains user/member information.
To import an existing CSV file, simply click the "Choose File" button, locate and select the CSV file on your computer, and then click the "Import Now" button to import the users.
You can also paste or type information into the box below the "Import Now" button instead of selecting a CSV file. The information in the box must follow the same format as the CSV file.
ie... "Id","Username","First Name","Last Name","Display Name","Email", "website","user level","custom capability"
There is a lot more to consider when importing users. The rest of this guide is a bit more advanced but can be helpful if you need to create your own import file or edit the export file.
Advanced User Importation Options
In this section we will look into a more advanced user importation method than the simple export/import options discussed above. Using the below details will help you if you have the need to import users from other membership platforms into OptimizeMember, as we will be discussing the formatting necessary to make that happen.
CSV Import Structure Tip
If you are not sure how to properly format your CSV file, we would recommend doing an export first, as the CSV file you download by exporting, would already be in the proper format and you could use that as sort of a boiler plate/template for building your own import files.
All import fields must be properly encapsulated using double quotes and separated by commas. You should also ensure that your import fields are in the proper order as well, otherwise the data may not be imported correctly.
You could also use the import file to do a mass update of your users as well.
CSV Import Formatting and Samples
The format is always going to be the same regardless if you are adding new users or updating existing ones. The only difference is the information you include or not include.
In the most basic recommended format, you would include the following fields:
"ID","Username","Password","First Name","Last Name","Display Name","Email","Website","User Role","Custom Capabilities"
For "User Role" that is actually the user level in OptimizeMember, and "custom capabilities", those are OptimizeMember packages.
It should also be noted that the difference between importing new users, and updating existing users is the presence of the ID field in each line.
If you want to update a user, please make sure the user ID is included.
If you are creating new users with the import file, any new user should NOT have a user ID included, however you still need to have the space there, so just put the quote marks with no ID in it, and it will work fine. Leaving out the double quotes for the ID field would mean the importation would fail, because it would think you mean the user name is the user ID which is not correct and importing would fail and show an error regarding this.
Example of importing a new user:
Example of importing a user who is getting updated:
In this example, the existing user johndoe22 is User ID 123 in WordPress. Also note there is no website in either example, and the membership level was increased and we added a "guitar" capability. OptimizeMember Packages should always be separated with commas and not have any spaces.
You may also include other data in the CSV for each user. Just do an export and see what fields you have available, and you can fill those in (or not).
Password value in the CSV import file
If you include a password it will be used, otherwise WordPress will automatically create a password (for new users).
For existing users, if you include the password then it will update that user's password. If you leave the password field blank for existing users, then the password will remain unchanged for that user.
Importation Will Always Be Performed Silently
Users will not be sent any emails from OptimizeMember when importing CSV files, unless you have another plugin that conflicts with OptimizeMember's ability to do the import properly. We would suggest testing one or two accounts before importing a large amount of users all at one time.
If you decide that you would rather have users notified by WordPress of their new account, you may wish to add the uses manually through the "WordPress Dashboard > Users > Add new" and select one of OptimizeMember's user roles.