eventsmanager

Custom booking date placeholder for my-bookings.php template

Apr 14th, 2015
377
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * This custom booking date placeholder can be use in /templates/my-bookings.php template
  3. *
  4. */
  5. add_filter('em_booking_output_placeholder','my_em_booking_date',1,3);
  6. function my_em_booking_date($replacement, $EM_Booking, $result){
  7. global $wpdb;
  8.  
  9. if ($result == '#_CUSTOMBOOKINGDATE') {
  10. $tablename = $wpdb->prefix.'em_bookings';
  11. $sql = $wpdb->prepare( "SELECT date_format(booking_date,'%%Y-%%m-%%d') as booking_date FROM $tablename WHERE booking_id = %d ", $EM_Booking->booking_id);
  12. $replacement = $wpdb->get_var($sql);
  13. }
  14.  
  15. return $replacement;
  16. }
RAW Paste Data