Advertisement
eventsmanager

Get Multiple Bookings Checkout Form Fields

Feb 1st, 2019
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. /**
  2. * Get multiple bookings checkout pages booking form fields using placeholder #_BOOKINGFORMCUSTOM{field_id}
  3. */
  4. if ( is_admin() )add_filter('em_booking_output_placeholder','my_bookings_placeholder',1,3);
  5. function my_bookings_placeholder($replace, $EM_Booking, $full_result){
  6. global $wpdb;
  7.  
  8. $main_booking_id= $wpdb->get_var($wpdb->prepare('SELECT booking_main_id FROM '.EM_BOOKINGS_RELATIONSHIPS_TABLE.' WHERE booking_id=%d', $EM_Booking->booking_id));
  9. $booking_meta = $wpdb->get_var($wpdb->prepare('SELECT booking_meta FROM '.EM_BOOKINGS_TABLE.' WHERE booking_id=%d', $main_booking_id));
  10. $booking_meta = unserialize($booking_meta);
  11.  
  12. $replace = '';
  13.  
  14. foreach($booking_meta['booking'] as $key => $value){
  15. if ( '#_BOOKINGFORMCUSTOM{'.$key.'}' == $full_result){
  16. $replace = $booking_meta['booking'][$key];
  17. break;
  18. }
  19. }
  20.  
  21. foreach($booking_meta['registration'] as $key => $value){
  22. if ( '#_BOOKINGFORMCUSTOM{'.$key.'}' == $full_result){
  23. $replace = $booking_meta['booking'][$key];
  24. break;
  25. }
  26. }
  27.  
  28. return $replace;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement