1 ) ? ($page-1)*$limit : 0; if( is_object($EM_Ticket) ){ $EM_Bookings = $EM_Ticket->get_bookings()->get_pending_bookings(); }else{ if( is_object($EM_Event) ){ $EM_Bookings = $EM_Event->get_bookings()->get_pending_bookings(); }else{ //To optimize performance, we can do one query here for all pending bookings to show. $EM_Bookings = EM_Bookings::get(array('status'=>0)); $events = array(); //Now let's create events and bookings for this: foreach($EM_Bookings->bookings as $EM_Booking){ //create event if( !array_key_exists($EM_Booking->event_id,$events) ){ $events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id); } } } } $bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0; ?>