Michael,
thanks for the response. I’ll try explain better…
I need to get submissions from anonymous users and assign them to some wordpress registered users; so I should store in a custom table a combination of (user_id – submission_id).
I think that the submit_time field should be great for the submission_id part, and that the wpcf7_before_send_mail hook is the right “place” to assign the submission to some users: my only problem is that i don’t know how/were to get the submit_time value in the hook!
This is my code:
add_action( 'wpcf7_before_send_mail', 'submission_to_user', 10);
function submission_to_user ( $f ) {
global $wpdb;
global $table_prefix;
// field ("1336380656.8600")
$submit_time = ''; // how to get this info??
$sql = "";
$usrs = $wpdb->get_results( "SELECT ... ;" );
if (0 == $wpdb->num_rows) {
// nobody
} else {
foreach ( $usrs as $usr ) {
if ("" != $sql) $sql .= ",";
$sql .= " (" . $usr->ID . ", " . $submit_time . ")";
}
$sql = 'INSERT INTO __________ (user_id, submission_id) VALUES' . $sql . ";";
}
if (false === $wpdb->query( $wpdb->prepare($sql) )) {
// ERROR
} else {
// OK
}
}