Last active
January 25, 2018 19:55
-
-
Save New0/91031595d4756ac70f525db1d6762658 to your computer and use it in GitHub Desktop.
Caldera Forms Reorder CSV Columns
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
/** | |
* Apply the new columns order in Csv attached to email and CSV stored in admin | |
*/ | |
add_filter( 'caldera_forms_email_csv_data', 'cf_reorder_csv_columns', 10, 2 ); | |
add_filter( 'caldera_forms_admin_csv', 'cf_reorder_csv_columns', 10, 2 ); | |
/** | |
* Reorder columns in Caldera Forms generated CSV file | |
*/ | |
function cf_reorder_csv_columns( $csv_data, $form ){ | |
//IMPORTANT change form ID ( CF5a5e8452c6f82) to match your form | |
//IMPORTANT the number after $csv_data match the order of current CSV columns, column A is 0, B is 1... | |
if( 'CF5a5e8452c6f82' === $form[ 'ID' ] ){ | |
$csv_data = array( | |
$csv_data[3], | |
$csv_data[5], | |
$csv_data[6], | |
$csv_data[0] | |
); | |
} | |
return $csv_data; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment