There are various reasons why you might want to export your members list to CSV—whether you want to back up your customer data, import members to a new email provider, or run reports on member data not built into Paid Memberships Pro, for example.
In this post, we’ll show you how to export your members list in PMPro, including the default columns included in the export, as well as a method to add additional user data to the file.
Access the Members List Export
The “Export to CSV” feature of Paid Memberships Pro is located on the Memberships > Members List admin page. Here you will see your full Members List, which can be filtered based on several features, including Membership Level, Status, or via search. The exported CSV file is based on the active filter in the current view. If you would like to add additional data to this admin page or allow for more detailed filtering, see:
- Add a Custom Column to the Members List and All Users Admin Pages
- Search Specific User and User Meta Fields on the Members List
Default Fields Included in the Members List Export
The basic CSV export will include the fields below, if they are available for the user. Not every field below is captured for every user and fields for some users may be blank in the export. This depends on your site settings and active payment gateway.
Data from the WordPress users
Table
- id: The User’s ID;
ID
- username: The user’s username;
user_login
- firstname: The user’s first name;
first_name
- lastname: The user’s last name;
last_name
- email: The user’s email address;
user_email
- joined: The date the user registered in the WordPress site (
user_registered
)
Data from the pmpro_memberships_users
Table
- membership: The user’s membership level name;
membership
- expires: The date the user’s membership level expires;
enddate
Data from the pmpro_subscriptions
Table
- subscription transaction id: The transaction id from the payment gateway;
subscription_transaction_id
- billing amount: The amount the user is paying per subscription term (ex “20” in “$20 every 3 months”);
billing_amount
- cycle period: The term of the user’s subscription (ex “Month” in “$20 every 3 months”);
cycle_period
- cycle number: How often the member will be paying per subscription term. (ex “3” in “$20 every 3 months”);
cycle_number
- next payment date: The date in
YYYY-MM-DD
format of when the next payment is due from the member;next_payment
_date
Data from the pmpro_discount_codes
Table
- discount_code_id: If membership was purchased using a discount code, the ID of the code;
id
- discount_code: If membership was purchased using a discount code, the code’s value;
code
Adding Additional Data to the Export
There are a few methods to add data to your CSV export.
Custom user fields are included in the export by default if you created the fields on the Memberships > Settings > User Fields admin page. You can override this behavior using custom code to extend the user field settings using the “memberslistcsv
” field option.
If you need to add fields that were not created via User Fields, you will need a custom function that uses the hook: pmpro_members_list_csv_extra_columns
.
For example, the code recipe below demonstrates how to add fields from the wp_users
or wp_usermeta
tables as well as fields added via BuddyPress.
There may be other custom tables you need to pull in data from, in which case you’d need to access the user information in another way (depending on the plugin you are trying to interact with).
The Code Recipe
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.
Then, for each additional column you would like to add, modify and/or duplicate lines 8 and 9 for your unique needs. You will then need a custom callback function for each column name (key) and user value (callback return).
Line 18 demonstrates how to access a usermeta
field, line 25 demonstrates how to access a field in the default WP_User
object, and line 32 demonstrates how to access a field from the BuddyPress profile fields.
Download the free ebook: Get 29 insights and ‘aha moments’ for new or veteran membership site business owners. Use these nuggets of wisdom to inspire or challenge you.