eventsmanager

Show private notes to bookings summary

May 8th, 2015
495
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /***
  2. * paste in your theme functions.php
  3. * after adding in your functions.php, go to Events > Bookings > Recent Bookings or by clicking an specific
  4. * click on the Gear icon and drag&drop field "Private Notes"
  5. *
  6. * This snippet will show the bookings private notes to the Bookings Summary page at Events > Bookings (Booking Notes section)
  7. *
  8. ***/
  9. function my_em_bookings_table_cols_template_attendee2($template, $EM_Bookings_Table){
  10. $template['private_notes'] = 'Private Notes';
  11. return $template;
  12. }
  13. add_action('em_bookings_table_cols_template', 'my_em_bookings_table_cols_template_attendee2',10,2);
  14.  
  15. function my_em_booking_notes_template($val, $col, $EM_Booking, $EM_Bookings_Table, $csv){
  16.  
  17. if( $col == 'private_notes' ){
  18. $temp = $EM_Booking->get_notes();
  19. $val .= '<ul>';
  20. foreach ($temp as $key => $value):
  21. $author = get_the_author_meta( 'display_name', $temp[$key]['author'] );
  22. $val .= '<li><ul>';
  23. $val .= '<li>'.'Author: '.$author.'</li>';
  24. $val .= '<li>'.'Notes: '.$temp[$key]['note'].'</li>';
  25. $val .= '</ul></li>';
  26. endforeach;
  27. $val .= '</ul>';
  28. }
  29.  
  30. return $val;
  31. }
  32. add_filter('em_bookings_table_rows_col','my_em_booking_notes_template', 10, 5);
RAW Paste Data