Bookings admin table

This topic contains 6 replies, has 2 voices, and was last updated by  David McCourt 9 years, 9 months ago.

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

    Hi Stephen

    I’m trying to amend the bookings admin table columns with the following code:

    function banana__wpe_booking_columns($columns) {
    
        unset($columns['booking_price']);
        $columns['test1'] = "Test1";
        $columns['test2'] = "Test2";
        return $columns;
    
    }
    
    add_filter('manage_event_page_bookings_columns', 'banana__wpe_booking_columns');
    

    This doesn’t work and I think it may be to do with the screen->id because if I use this on posts, it works:

    add_filter('manage_posts_columns', 'banana__wpe_booking_columns');
    

    I did have the Modern Tribe Events Calendar plugin installed (now removed) but I know that creates an event post type. I don’t know if that might be an issue.

    Thanks

    David McCourt
    #16927

    You’ll need to use a later priority:

    add_filter('manage_event_page_bookings_columns', 'banana__wpe_booking_columns', 15 );
    

    (I’d forgotten that when I provided the snippet).

    Stephen Harris
    #16928

    Appreciate the quick response. Thanks Stephen, that works.

    Final question: how to get the booking form additional fields? I can’t get any of these to work:

    $org = get_post_meta($item->ID, 'organisation');
    

    or

    $org = eo_get_booking_meta($item->ID, 'organisation');
    

    or

    $event_id = eo_get_booking_meta($item->ID, 'event_id'); 
    $org = get_post_meta($event_id, 'organisation');
    

    or

    $event_id = eo_get_booking_meta($item->ID, 'event_id'); 
    $org = eo_get_booking_meta($event_id, 'organisation');
    

    Thanks!

    David McCourt
    #16929

    Hi David,

    Each field added to the form as an ID, you can get the associated data via:

    $value = eo_get_booking_meta( $booking_id, $element_id, true ); 
    
    Stephen Harris
    #16933

    Hmm. Can’t get this to return anything. I can see the data in the postmeta table but an empty string is returned. The element ID is just the number?

    $org = eo_get_booking_meta($item->ID, 4, true);
    

    $item->ID is the same as the booking_id

    David McCourt
    #16934

    That’s correct.

    My previous response was incorrect, the key is meta_4 (for an element of ID 4)

    Stephen Harris
    #16945

    Perfect, thank you!

    David McCourt
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.