Add column to booking list in admin

WordPress Event Management, Calendars & Registration Forums General Question Add column to booking list in admin

This topic contains 6 replies, has 2 voices, and was last updated by  Alex Steer 9 years, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17708

    Hi Stephen,

    How can I add a column to show the chosen gateway on the booking listings admin page?

    Many thanks,

    Alex

    Alex Steer
    #17716

    This snippet will do that

    //Add columns
    add_filter( 'manage_event_page_bookings_columns', function( $columns ){
       $columns['my-gateway'] = 'Gateway';
       return $columns;
    }, 11 );
    
    //Print column cell
    add_action( 'eventorganiser_booking_table_column', function( $column_name, $item ){
       if ( 'my-gateway' == $column_name ) {
             echo esc_html( eo_get_booking_meta( $item->ID, 'gateway' ) );
       }
    }, 10, 2 );
    
    • This reply was modified 9 years, 8 months ago by  Stephen Harris.
    • This reply was modified 9 years, 8 months ago by  Stephen Harris.
    Stephen Harris
    #17718

    Sorry,

    This one is not working for some reason, any ideas? No errors and no output.

    I have an admin columns plugin installed would that conflict?

    Alex Steer
    #17720

    Nope, I made a mistake, callback must have priority 11 or higher. I’ve made the changes.

    Stephen Harris
    #17722

    I have the column but it is empty now?

    Alex Steer
    #17725

    An error again, $item->ID was $booking_id, but that isn’t defined.

    Stephen Harris
    #17726

    Sorted – many thanks.

    Alex Steer
Viewing 7 posts - 1 through 7 (of 7 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.