Last active
August 24, 2022 13:13
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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