Last active
April 7, 2018 21:10
-
-
Save strangerstudios/3111715 to your computer and use it in GitHub Desktop.
Add Website and Nickname Fields to the Paid Memberships Pro 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
/* | |
Plugin Name: PMPro Extra Members List CSV Export Columns | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-extra-members-list-csv-export-columns/ | |
Description: Add extra fields to the Paid Memberships Pro Members List CSV Export | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
Notes on use: | |
Add extra fields to the members list CSV export. | |
Requires PMPro version 1.5.1 or later. | |
The filter should return an array ($columns). | |
Array keys are the column headings (string). | |
Array values are callback functions to use (string). | |
The callback function should accept one parameter (an object containing user data and meta values) and return a value to output to the CSV. | |
*/ | |
function my_pmpro_members_list_csv_extra_columns($columns) | |
{ | |
$columns["website"] = "my_extra_column_website"; | |
$columns["nickname"] = "my_extra_column_nickname"; | |
return $columns; | |
} | |
add_filter("pmpro_members_list_csv_extra_columns", "my_pmpro_members_list_csv_extra_columns", 10, 2); | |
function my_extra_column_website($user) | |
{ | |
return $user->user_url; | |
} | |
function my_extra_column_nickname($user) | |
{ | |
return $user->metavalues->nickname; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment