Remove all commas from entry exports except for upload fields

We have a need to strip out all commas from entry exports for an external integration. We accomplished this using the following code where it removes all commas upon submitting the form:

add_filter(“gform_save_field_value”, “remove_commas”, 10, 4);
function remove_commas($value, $entry, $field, $form){
$new_value = str_replace(array(“,”), ‘’, $value);
return $new_value;
}

However, this causes issues specifically for Upload Fields that allow multiple files to be uploaded, since it separates the image URLs by commas in the entry exports. Does anyone know if there is a way to universally exclude file upload fields from this code?

Disregard, I managed to get this working with the following code:

add_filter(“gform_save_field_value”, “remove_commas”, 10, 4);
function remove_commas($value, $entry, $field, $form){
if ( $field->get_input_type() == ‘fileupload’ ) {
return $value;
} else {
$new_value = str_replace(array(“,”), ‘’, $value);
return $new_value;
}
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.