Clean up external records when a donor requests data erasure
If you store donor information in an external system — a CRM, a mailing list, or your own database — you need to remove it there when a donor asks to have their data deleted. Benecaster handles its own records automatically; this hook fires immediately after that deletion completes so you can mirror it in any connected system.
This is the right hook if you need to demonstrate GDPR compliance across your full data footprint, not just the records Benecaster holds directly.
The hook fires only on explicit deletion requests, not during routine data retention sweeps, so you can distinguish intentional deletions in your own audit logs. The $deleted count tells you how many donation records were removed — checking for greater than zero prevents unnecessary calls to external services when no records existed.
Code
<?php
add_action( 'benecaster_donor_data_erased', function ( string $email, int $deleted ): void {
if ( $deleted > 0 ) {
my_crm_purge_contact( $email );
}
}, 10, 2 );
Hooks Used
-
benecaster_donor_data_erased