Created
July 1, 2025 01:10
-
-
Save rickalday/d0144bd1d60888fab623d869392e7646 to your computer and use it in GitHub Desktop.
Include Company name in GiveWP Donor Export
This file contains hidden or 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 | |
add_filter( 'give_export_donors_get_default_columns', static function($columnData) { | |
$columnData['donor_company'] = esc_html__( 'Company', 'give' ); | |
return $columnData; | |
}); | |
use Give\Donors\Models\Donor; | |
add_filter( 'give_export_get_data_donors', static function($exportData) { | |
foreach($exportData as $key => $data){ | |
$email = $data['email']; | |
$donorId = Donor::whereEmail($email)->id; | |
$donor_company = give()->donor_meta->get_meta( $donorId, '_give_donor_company', true); | |
$exportData[$key]['donor_company'] = ! empty($donor_company) ? $donor_company : '- N/A - '; | |
} | |
return $exportData; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment