Created
July 20, 2017 17:24
-
-
Save greathmaster/d2fc743e0f932caf6863ef41857b8be8 to your computer and use it in GitHub Desktop.
Remove Billing addresses fields and headings from CSV Member 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
function my_pmpro_members_list_csv_default_columns($default_columns) | |
{ | |
$new_default_columns = array(); | |
$remove = array('pmpro_bfirstname', 'pmpro_blastname', 'pmpro_baddress1', 'pmpro_baddress2', 'pmpro_bcity', 'pmpro_bstate', 'pmpro_bzipcode', 'pmpro_bcountry', 'pmpro_bphone'); | |
foreach($default_columns as $key => $value) | |
{ | |
if(!in_array($value[1], $remove)) | |
$new_default_columns[] = $value; | |
} | |
return $new_default_columns; | |
} | |
add_filter('pmpro_members_list_csv_default_columns', 'my_pmpro_members_list_csv_default_columns'); | |
function my_pmpro_members_list_csv_heading($csv_header) | |
{ | |
$heading = explode(',', $csv_header); | |
$remove = array('billing firstname', 'billing lastname', 'address1', 'address2', 'city', 'state', 'zipcode', 'country', 'phone'); | |
foreach($heading as $key => $title) | |
{ | |
if(in_array($title, $remove)) | |
unset($heading[$key]); | |
} | |
$csv_header = implode(',', $heading); | |
return $csv_header; | |
} | |
add_filter('pmpro_members_list_csv_heading', 'my_pmpro_members_list_csv_heading'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's perfect, works like a dream.
Is there a similar filter for "orders"?