eventsmanager

Add date of event to PayPal ticket names

Jul 23rd, 2018
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php
  2. /*
  3. This function will add the date of the event to the ticket name on PayPal
  4.  
  5. Please note that this may cause problems for longer ticket names.
  6.  
  7. For installation instructions - http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  8. */
  9. function my_em_paypal_vars_ticketdescs($paypal_vars, $EM_Booking){
  10.     $count = 1;
  11.     $date_format = ( get_option('dbem_date_format') ) ? get_option('dbem_date_format'):get_option('date_format');
  12.     foreach( $EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking ){
  13.         $paypal_vars['item_name_'.$count] = wp_kses_data($EM_Ticket_Booking->get_ticket()->ticket_name .' - '.$EM_Ticket_Booking->get_booking()->get_event()->event_name.' - '.date_i18n($date_format, $EM_Ticket_Booking->get_booking()->get_event()->start));
  14.         $count++;
  15.     }
  16.     return $paypal_vars;
  17. }
  18. add_filter('em_gateway_paypal_get_paypal_vars', 'my_em_paypal_vars_ticketdescs',10,2);
Add Comment
Please, Sign In to add comment