Last active
June 7, 2023 18:24
-
-
Save rickalday/f3a7553d6d0df7280360069a7a782ea4 to your computer and use it in GitHub Desktop.
Add Donor Creation Date to Donor Export File
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
<?php | |
function give_add_custom_column_to_export_donor( $default_columns ) { | |
$default_columns['date_created'] = esc_html__( 'Donor Created Date', 'give' ); | |
return $default_columns; | |
} | |
add_filter( 'give_export_csv_cols_donors', 'give_add_custom_column_to_export_donor' ); | |
add_filter( 'give_export_donors_get_default_columns', 'give_add_custom_column_to_export_donor' ); | |
function give_export_set_custom_donor_data( $data, $donor ) { | |
$created_date = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); | |
$data['date_created'] = ! empty( $date_created ) ? $date_created : '- N/A - '; | |
return $data; | |
} | |
add_filter( 'give_export_set_donor_data', 'give_export_set_custom_donor_data', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment