The following are examples of how to filter / modify the eTapestry Mapping gift transaction. Add the filter and function to your functions.php file.
The transaction is an array. To see the structure and possible values, view the Blackbaud API documentation HERE.
To add a note to the gift transaction:
add_filter('eTapMapping_gift_transaction', 'custom_filter_gift', 10, 2); function custom_filter_gift( $transaction, $entry){
$my_field_no = ‘8’; // change to your field id number
if ( ! empty( $entry[ $my_field_no ] ) ){
$transaction[‘note’] = sanitize_text_field($entry[ $my_field_no ]);
}
return $transaction;
}
Modify a constituent or tribute user defined field created with a Gravity Forms date field to match the etapestry required date format mm/dd/yyyy
(You can also change your field from a date field to a text field with a Date input mask. This will match eTapestry’s format requirement.)
add_filter('eTapMapping_defined_values', 'custom_filter_udfs', 10, 2);
function custom_filter_udfs( $defined_values, $entry ){
//var_dump( $defined_values );die(); // uncomment while testing to see array structure and get reference no
if ( ! empty( $defined_values ) ){
$reference_no = ‘3188.0.2675’; // hard code this to match your mapped account
foreach ( $defined_values as $k => $a ){
if ( $reference_no == $a[‘fieldRef’] ){
// This is our date field so format the date
$defined_values[$k][‘value’] = date(‘m/d/Y’, strtotime( $a[‘value’] ) );
break;
}
}
}
//var_dump($defined_values);die(); //uncomment to test to see if the array was properly changed (not for live sites!)
return $defined_values;
}