Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active December 30, 2015 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/0977c325c28142cbbf5b to your computer and use it in GitHub Desktop.
Save Pebblo/0977c325c28142cbbf5b to your computer and use it in GitHub Desktop.
Exclude fields from the registration CSV export.
<?php
/*
Plugin Name: Exclude custom fields from EE registrations export.
Description: Allows you to set felds that will be excluded from the registrations CSV export file.
Author: Tony Warwick
Version: 1.0
*/
function ee_exclude_custom_fields_from_export($reg_csv_array, $reg_row) {
$fields_to_exclude_from_csv = array(
//Add the fields you wish to exclude from the CSV here.
//These excluded fields are an example of how to remove fields, your list will be different.
'Payment Date(s)',
'Payment Method(s)',
'Gateway Transaction ID(s)',
'Check-Ins',
);
foreach( $fields_to_exclude_from_csv as $single_field_to_exclude ) {
//For each field within $fields_to_exclude_from_csv, check if that value is within the array.
if ( array_key_exists( $single_field_to_exclude, $reg_csv_array )) {
//If the field is set remove it from the array.
unset( $reg_csv_array[$single_field_to_exclude] );
}
}
return $reg_csv_array;
}
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'ee_exclude_custom_fields_from_export', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment