Forked from greathmaster/pmpro-remove-billing-address-fields-headings-csv.php
Created
October 12, 2018 22:16
-
-
Save itsjusteileen/d8efd51c0e463febd5a06a205cab5f98 to your computer and use it in GitHub Desktop.
Remove Billing addresses fields and headings from CSV Member 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
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