/ticket_id_export.php Secret
Last active
October 13, 2017 17:25
-
-
Save cliffordp/a3c9da35e1b4e7ca2236374c802359eb to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Event Tickets: Attendees Report: CSV Export: Add Ticket ID (a.k.a. Attendee | |
* ID) column to the CSV Export. | |
* | |
* @link https://gist.github.com/cliffordp/a3c9da35e1b4e7ca2236374c802359eb | |
*/ | |
add_action( 'tribe_events_tickets_generate_filtered_attendees_list', 'tec_extend_ticket_export' ); | |
function tec_extend_ticket_export( $event_id ) { | |
if ( ! is_admin() ) { | |
return; | |
} | |
add_filter( 'tribe_events_tickets_attendees_csv_export_columns', 'tec_add_ticket_id_column' ); | |
add_filter( 'tribe_events_tickets_attendees_table_column', 'tec_populate_ticket_id_column', 10, 3 ); | |
} | |
function tec_add_ticket_id_column( $columns ) { | |
if ( ! is_admin() ) { | |
return $columns; | |
} | |
$columns['ticket_id'] = 'Ticket ID'; | |
return $columns; | |
} | |
function tec_populate_ticket_id_column( $existing, $item, $column ) { | |
if ( ! is_admin() ) { | |
return $existing; | |
} | |
if ( 'ticket_id' == $column ) { | |
return $item['attendee_id']; | |
} | |
return $existing; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment