Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Created September 14, 2020 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/9da566fcf561856d7775459fda4593de to your computer and use it in GitHub Desktop.
Save lorenzocaum/9da566fcf561856d7775459fda4593de to your computer and use it in GitHub Desktop.
add_filter( 'FHEE__EE_Export__report_registrations__reg_csv_array', 'ssci_add_um_fields_to_export', 10, 2);

function ssci_add_um_fields_to_export( $reg_csv_array, $reg_row ) {

  // use global wpdb object to access db (select user meta fields to export)
  global $wpdb;

  // Add user id obtain from attendee id
  $attendee_id = $reg_row['Registration.ATT_ID'];   //#1: --Causes Site Crash;  Is it an Associative Array?

   $user_id = $wpdb->get_results( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'wp_EE_Attendee_ID' and meta_value = 10498" );    //#2: -- returns value is a:1:{i:0;O:8:"stdClass":1:{s:7:"user_id";s:4:"6404";}} 
    
//$reg_csv_array['User id'] = $user_id;    
$reg_csv_array['ATT_ID'] => $attendee_id;       
                
   // always return csv array                          
   return $reg_csv_array;
                
} //End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment