Created
January 30, 2026 08:49
-
-
Save davidmutero/4420df49f83c6c7a108fbaf5d39708be to your computer and use it in GitHub Desktop.
Add Member Notes to the PMPro Members List CSV Export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Add Member Notes (user_notes) to the PMPro Members List CSV export. | |
| * | |
| * This recipe adds a new "Member Notes" column to the CSV | |
| * and populates it from the user meta key `user_notes`. | |
| * | |
| * 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. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| /** | |
| * Register the extra CSV column. | |
| */ | |
| function my_pmpro_members_list_csv_extra_columns( $columns ) { | |
| $columns['member_notes'] = 'my_pmpro_members_list_member_notes'; | |
| return $columns; | |
| } | |
| add_filter( 'pmpro_members_list_csv_extra_columns', 'my_pmpro_members_list_csv_extra_columns' ); | |
| /** | |
| * Populate the Member Notes column. | |
| * | |
| * @param WP_User $user The user object for the row. | |
| * @return string Sanitized member notes. | |
| */ | |
| function my_pmpro_members_list_member_notes( $user ) { | |
| $notes = get_user_meta( $user->ID, 'user_notes', true ); | |
| if ( empty( $notes ) ) { | |
| return ''; | |
| } | |
| return wp_strip_all_tags( $notes ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment