eventsmanager

Bookings/Registration metabox: Booked Spaces Count

Jan 15th, 2026 (edited)
3,933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. function my_get_ticket_booked_spaces( $booked_spaces, $EM_Ticket ){
  4. global $wpdb;
  5.  
  6. $table_name = $wpdb->prefix.'em_tickets_bookings';
  7. $table_booking = $wpdb->prefix.'em_bookings';
  8. $booked_spaces = $wpdb->get_var('
  9. SELECT SUM(t.ticket_booking_spaces) AS booked_space
  10. FROM '.$table_name.' t
  11. LEFT JOIN '.$table_booking.' b ON t.booking_id = b.booking_id
  12. WHERE
  13. b.booking_status = 1 AND
  14. t.ticket_id='. absint($EM_Ticket->ticket_id) .' GROUP BY t.ticket_id');
  15.  
  16. return $booked_spaces;
  17. }
  18. add_filter('em_ticket_get_booked_spaces', 'my_get_ticket_booked_spaces', 100, 2 );
Advertisement