I think I have found the problem.
I’m no expert…but in the file CF7DBPlugin.php there is a function called public function saveFormData($cf7), looking at this it would seem that the $cf7->title is examined before the call to cfdb_form_data where we can alter the contents of the submission (see code above).
I don’t know what the knock on repercussions of this may be – maybe Michael could comment on this code change?
So, this is what I did….it would appear that all we need do is move the test.
$title = stripslashes($cf7->title);
if ($this->fieldMatches($title, $this->getNoSaveForms())) {
return; // Don't save in DB
}
to a point after the call to cfdb_form_data like so:
public function saveFormData($cf7) {
try {
// moved by David 9.9.13
// $title = stripslashes($cf7->title);
// if ($this->fieldMatches($title, $this->getNoSaveForms())) {
// return; // Don't save in DB
// }
$time = function_exists('microtime') ? microtime(true) : time();
$ip = (isset($_SERVER['X_FORWARDED_FOR'])) ? $_SERVER['X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
// Set up to allow all this data to be filtered
$cf7->submit_time = $time;
$cf7->ip = $ip;
$user = null;
if (is_user_logged_in()) {
$current_user = wp_get_current_user(); // WP_User
$user = $current_user->user_login;
}
$cf7->user = $user;
try {
$newCf7 = apply_filters('cfdb_form_data', $cf7);
if ($newCf7 && is_object($newCf7)) {
$cf7 = $newCf7;
$time = $cf7->submit_time;
$ip = $cf7->ip;
$user = $cf7->user;
}
else {
error_log('CFDB Error: No or invalid value returned from "cfdb_form_data" filter: ' .
print_r($newCf7, true));
}
}
catch (Exception $ex) {
error_log(sprintf('CFDB Error: %s:%s %s %s', $ex->getFile(), $ex->getLine(), $ex->getMessage(), $ex->getTraceAsString()));
}
// David - 9.9.2013 inserted code here
$title = stripslashes($cf7->title);
if ($this->fieldMatches($title, $this->getNoSaveForms())) {
return; // Don't save in DB
}
$tableName = $this->getSubmitsTableName();
$parametrizedQuery = "INSERT INTO <code>$tableName</code> (<code>submit_time</code>, <code>form_name</code>, <code>field_name</code>, <code>field_value</code>, <code>field_order</code>) VALUES (%s, %s, %s, %s, %s)";
$parametrizedFileQuery = "INSERT INTO <code>$tableName</code> (<code>submit_time</code>, <code>form_name</code>, <code>field_name</code>, <code>field_value</code>, <code>field_order</code>, <code>file</code>) VALUES (%s, %s, %s, %s, %s, %s)";
$order = 0;
$noSaveFields = $this->getNoSaveFields();
$foundUploadFiles = array();
global $wpdb;
...