Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. <?php
  2. //* Please do NOT include the opening php tag, except of course if you're starting with a blank file
  3.  
  4. add_filter(
  5. 'FHEE_manage_event-espresso_page_espresso_registrations_columns',
  6. 'my_filter_registration_list_table_columns',
  7. 10,
  8. 2
  9. );
  10. add_action(
  11. 'AHEE__EE_Admin_List_Table__column_txnnumber__event-espresso_page_espresso_registrations',
  12. 'my_registration_list_table_txnnumber_column',
  13. 10,
  14. 2
  15. );
  16.  
  17. /**
  18. * this function adds the column name to the array of table headers
  19. *
  20. * @param array $columns
  21. * @param string $screen
  22. * @return array
  23. */
  24. function my_filter_registration_list_table_columns( $columns, $screen ) {
  25. if ( $screen === "espresso_registrations_default" ) {
  26. $offset = isset($columns['TXN_paid']) ? 'TXN_paid' : '_REG_paid';
  27. $columns = EEH_Array::insert_into_array(
  28. $columns,
  29. array( 'txnnumber' => 'Transaction Number' ),
  30. $offset,
  31. false
  32. );
  33. }
  34. return $columns;
  35. }
  36.  
  37. /**
  38. * this function echoes out the data you want to appear in your custom column.
  39. *
  40. * @param \EE_Registration $item
  41. * @param string $screen
  42. */
  43. function my_registration_list_table_txnnumber_column( $item, $screen ) {
  44. if ( $screen === "espresso_registrations_default" && $item instanceof EE_Registration ) {
  45. $txn = $item->transaction();
  46. if ($txn instanceof EE_Transaction) {
  47. $txn_payments = $txn->approved_payments();
  48. foreach($txn_payments as $txn_payment) {
  49. if($txn_payment instanceof EE_Payment) {
  50. echo $txn_payment->txn_id_chq_nmbr() . '<br>';
  51. }
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement