Hi Stephen,
Huge fan of your plugin, in fact we’ve just purchased a 7th license!
Quick question – one client has offline payments enabled in addition to PayPal, but when they’re viewing all bookings via the dashboard there’s no way to tell which are offline payments – (so they know which bookees to chase for payment).
Do you have a quick snippet to add an admin column on the bookings page, to indicate payment method?
Thanks in advance,
Chris
Chris Dunst
Hi Chris,
Glad you like the plug-in :). Here’s a snippet that will do just that:
add_filter( 'manage_event_page_bookings_columns', function( $columns ) {
$columns['gateway'] = 'Gateway';
return $columns;
}, 20 );
add_action( 'eventorganiser_booking_table_column', function( $column, $booking ) {
if ( 'gateway' !== $column ) {
return;
}
echo esc_html( eo_get_booking_meta( $booking->ID, 'gateway' ) );
}, 10, 2 );
Stephen Harris
Hi Stephen
This snippet still works, thanks. It doesn’t add the gateway column to the CSV though. Is it possible to also add it there?
Thank you!
Oliver Flueckiger
Yes, here is a snippet for adding it to the bookings export (a similar filter exists for tickets export):
add_filter( 'eventorganiser_export_bookings_headers', function( $columns ) {
$columns['gateway'] = 'gateway';
return $columns;
} );
add_filter('eventorganiser_export_bookings_cell_mycustomcolumn', function( $cell, $booking ) {
return eo_get_booking_meta( $booking->ID, 'gateway' )
}, 10, 2 );
Stephen Harris
Hi Stephen
Thanks!
It correctly adds the column “gateway” to the CSV file, but the cells are empty. Can you please double-check?
Btw, there’s a semicolon missing:
return eo_get_booking_meta( $booking->ID, 'gateway' )**;**
Oliver Flueckiger
Sorry Oliver I didn’t see this reply. The key of the $columns
array must match the suffix of the filter used to return the cell content. Here’s a corrected and tested version:
add_filter( 'eventorganiser_export_bookings_headers', function( $columns ) {
// this key must match the suffix to
// the eventorganiser_export_bookings_cell_<suffix> hook below
$columns['mycustomcolumn'] = 'gateway';
return $columns;
} );
add_filter('eventorganiser_export_bookings_cell_mycustomcolumn', function( $cell, $booking ) {
return eo_get_booking_meta( $booking->ID, 'gateway' );
}, 10, 2 );
Stephen Harris