eventsmanager

Changing Default Ticket Type

May 24th, 2013 (edited)
3,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.03 KB | None | 0 0
  1. function my_em_add_default_tickets($tickets, $EM_Bookings) {
  2.    
  3.     if ( empty($tickets->tickets) ) {
  4.         $ticket_data = array();
  5.        
  6.         $ticket_data[0] = array( 'ticket_name' => 'General Admission', 'ticket_spaces' => 10, 'ticket_price' => 450, 'ticket_min' => 0, 'ticket_max' => 5 );
  7.         $ticket_data[1] = array( 'ticket_name' => 'Section A', 'ticket_spaces' => 10, 'ticket_price' => 550, 'ticket_min' => 0, 'ticket_max' => 5 );
  8.        
  9.         foreach ($ticket_data as $ticket) {
  10.            
  11.             $EM_Ticket = new EM_ticket();
  12.             $EM_Ticket->ticket_name   = $ticket['ticket_name'];
  13.             $EM_Ticket->ticket_spaces = $ticket['ticket_spaces'];
  14.             $EM_Ticket->ticket_price = $ticket['ticket_price'];
  15.             $EM_Ticket->ticket_min = $ticket['ticket_min'];
  16.             $EM_Ticket->ticket_max = $ticket['ticket_max'];
  17.            
  18.             $tickets->tickets[] = $EM_Ticket;
  19.         }
  20.     }
  21.    
  22.     return $tickets;
  23. }
  24. add_filter('em_bookings_get_tickets', 'my_em_add_default_tickets', 100, 2);
Advertisement
Add Comment
Please, Sign In to add comment