caldera_forms_email_csv_data

A Volcano In The Distance

This filter allows you to modify the data used to create the CSV attached to the email.

This filter was added in Caldera Forms 1.5.3

Add A Column To Caldera Forms Email CSV

<?php
/**
* Add an additional column to Caldera Forms email CSV
*/
add_filter( 'caldera_forms_email_csv_data', function( $csv_data, $form ){
//IMPORTANT change form ID to match your form
if( 'cf123456' === $form[ 'ID' ] ){
$csv_data[] = array(
'label' => 'Unique ID',
'data' => uniqid( 'prefix' )
);
}
return $csv_data;
}, 10, 2 );

Change A Label In Caldera Forms Email CSV

.<?php
/**
* Change the label of a specific field in Caldera Forms email CSV
*/
add_filter( 'caldera_forms_email_csv_data', function( $csv_data, $form ){
//IMPORTANT change form ID to match your form
if( 'cf123456' === $form[ 'ID' ] ){
$labels = wp_list_pluck( $csv_data , 'label' );
foreach ( $labels as $i => $label ){
if( 'Price' === $label ){
$label = 'Total Price';
$csv_data[ $i ] = $label;
}
}
}
return $csv_data;
}, 10, 2 );

Change CSVs Exported In Caldera Forms Admin

This filter will not affect a CSV export of entry data generated in the Caldera Forms Admin Viewer. You can the caldera_forms_admin_csv filter for that.

 

Where Does This Code Go?

When using WordPress hooks to customize Caldera Forms or other plugins you should not modify the plugin files, or you will lose your changes when you update the plugin. Instead you should create a small plugin to hold the custom code. It's easy, learn how here.

Technically you can add the custom code to your theme's functions.php, but then you will not be able to change your theme and keep these customizations.

Learn More

f