Forum Replies Created

Viewing 3 replies - 286 through 288 (of 288 total)
  • 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
    	}
    }

    I’m interested to this question too.
    I’d like to insert a dropdown with a city list…

    Regards, Nicola

    Excuse me for re-opening this post…
    I see the submit_time field but, how can i know it in the wpcf7_before_send_mail?

    Obviously, I use cfdb plugin to store submissions into my db; I need also to assign a single submission to some wordpress users, so I need a unique field to use like a primary key.
    Is the before_send_mail hook the right way? Any suggestion?

    Thanks in advance and excuse my English! 🙂

Viewing 3 replies - 286 through 288 (of 288 total)