Skip to content

Instantly share code, notes, and snippets.

@geotsiokos
Last active August 24, 2022 13:13
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 geotsiokos/f3a11ce8475a86a1c5a639b1f9cc5ef7 to your computer and use it in GitHub Desktop.
Save geotsiokos/f3a11ce8475a86a1c5a639b1f9cc5ef7 to your computer and use it in GitHub Desktop.
Adds extra column in Affiliates > Total, Export file for custom registration field with name extra_field
add_filter( 'affiliates_totals_export_file_headings', 'example_affiliates_totals_export_file_headings' );
function example_affiliates_totals_export_file_headings( $headings ) {
$headings[] = 'Data';
return $headings;
}
add_filter( 'affiliates_totals_export_file_line', 'example_affiliates_totals_export_file_line', 10, 4 );
function example_affiliates_totals_export_file_line( $line, $affiliate_id, $user_id, $result ) {
$extra_field = get_user_meta( $user_id, 'extra_field', true );
if ( $extra_field ) {
$line['suffix'] = $extra_field;
}
return $line;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment