Created
July 5, 2024 13:20
-
-
Save dwanjuki/9ac712b1fd24c8260218622101edf187 to your computer and use it in GitHub Desktop.
Add the user's Display Name to the Members List CSV export
This file contains 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 the user's Display Name to the Members List CSV | |
* | |
* 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. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_members_list_csv_display_name_column( $columns ) { | |
$columns["display_name"] = "my_pmpro_members_list_csv_display_name_column_data"; | |
return $columns; | |
} | |
add_filter( 'pmpro_members_list_csv_extra_columns', 'my_pmpro_members_list_csv_display_name_column' ); | |
function my_pmpro_members_list_csv_display_name_column_data( $user ) { | |
return $user->display_name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment