Title: antdigital's Replies | WordPress.org

---

# antdigital

  [  ](https://wordpress.org/support/users/antdigital/)

 *   [Profile](https://wordpress.org/support/users/antdigital/)
 *   [Topics Started](https://wordpress.org/support/users/antdigital/topics/)
 *   [Replies Created](https://wordpress.org/support/users/antdigital/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/antdigital/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/antdigital/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/antdigital/engagements/)
 *   [Favorites](https://wordpress.org/support/users/antdigital/favorites/)

 Search replies:

## Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] How to call submit_time](https://wordpress.org/support/topic/how-to-call-submit_time/)
 *  Thread Starter [antdigital](https://wordpress.org/support/users/antdigital/)
 * (@antdigital)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/how-to-call-submit_time/#post-8291099)
 * I think I should be clearer.
 * So I followed your guidance and this is my function codes
 *     ```
       function testform($formData) {
       require_once(ABSPATH . 'wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php');
           // Change $formData
       	    if (!isset($posted_data['submit_time'])) {
               $plugin = new CF7DBPlugin();
               $posted_data['submit_time'] = $plugin->generateSubmitTime();
           }
       	 $formData->posted_data['email'] = $posted_data['submit_time'];
   
           return $formData; // be sure to return it
       }
   
       add_filter('cfdb_form_data', 'testform');
       ```
   
 * and gotten this [result](https://img42.com/j0pXe) ([https://img42.com/j0pXe](https://img42.com/j0pXe))
   
   However as shown in the screenshot, I actually wanted the submit_time and field_value
   to have the same value (1476347176.3544 on both side instead of 1476347176.4563
   on the field_value side).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] How to call submit_time](https://wordpress.org/support/topic/how-to-call-submit_time/)
 *  Thread Starter [antdigital](https://wordpress.org/support/users/antdigital/)
 * (@antdigital)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/how-to-call-submit_time/#post-8288605)
 * Hi Michael,
    I took your advice to move my function, from my “/theme/functions.
   php” to <Add Shortcodes Actions And Filters> plugin.
 * However I’ve not change the place I called the function, as on_sent_ok:”insert_submit_time_into_other_db(
   $formData);” gave me an referenceerror (insert_submit_time_into_other_db is not
   defined).
 * I see the “lagged time” problem is caused by
 *     ```
           if (!isset($posted_data['submit_time'])) {
               $plugin = new CF7DBPlugin();
               $posted_data['submit_time'] = $plugin->generateSubmitTime();
           }
       ```
   
 * submit_time was not set and was generated again.
 * What could be the reason that $posted_data[‘submit_time’] is unable to get the
   submit_time in my function (on_sent_ok:”insert_submit_time_into_other_db($formData);)
 * Sorry for the troubles but thank you!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] How to call submit_time](https://wordpress.org/support/topic/how-to-call-submit_time/)
 *  Thread Starter [antdigital](https://wordpress.org/support/users/antdigital/)
 * (@antdigital)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/how-to-call-submit_time/#post-8281240)
 * Hi Michael,
 * Thank you so much for the detailed guide, however the value still does not tally.
   (
   eg. 1476261782.1369 in my function, but the actual submit_time is 1476261781.9349)
 * Could the problem be in where I call the function.
 *     ```
       ///wp-content/plugins/contact-form-7/includes/submission.php
   
       private function submit() {
       		if ( ! $this->is( 'init' ) ) {
       			return $this->status;
       		}
   
       		$this->meta = array(
       			'remote_ip' => isset( $_SERVER['REMOTE_ADDR'] )
       				? preg_replace( '/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR'] )
       				: '',
       			'user_agent' => isset( $_SERVER['HTTP_USER_AGENT'] )
       				? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '',
       			'url' => preg_replace( '%(?<!:|/)/.*$%', '',
       				untrailingslashit( home_url() ) ) . wpcf7_get_request_uri(),
       			'timestamp' => current_time( 'timestamp' ),
       			'unit_tag' => isset( $_POST['_wpcf7_unit_tag'] )
       				? $_POST['_wpcf7_unit_tag'] : '' );
   
       		$contact_form = $this->contact_form;
   
       		if ( ! $this->validate() ) { // Validation error occured
       			$this->status = 'validation_failed';
       			$this->response = $contact_form->message( 'validation_error' );
   
       		} elseif ( ! $this->accepted() ) { // Not accepted terms
       			$this->status = 'acceptance_missing';
       			$this->response = $contact_form->message( 'accept_terms' );
   
       		} elseif ( $this->spam() ) { // Spam!
       			$this->status = 'spam';
       			$this->response = $contact_form->message( 'spam' );
   
       		} elseif ( $this->mail() ) {
       insert_submit_time_into_other_db($formData); //========!FUNCTION HERE!========
       			$this->status = 'mail_sent';
       			$this->response = $contact_form->message( 'mail_sent_ok' );
   
       			do_action( 'wpcf7_mail_sent', $contact_form );
   
       		} else {
       			$this->status = 'mail_failed';
       			$this->response = $contact_form->message( 'mail_sent_ng' );
   
       			do_action( 'wpcf7_mail_failed', $contact_form );
       		}
   
       		$this->remove_uploaded_files();
   
       		return $this->status;
       	}
       ```
   
    -  This reply was modified 9 years, 7 months ago by [antdigital](https://wordpress.org/support/users/antdigital/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Contact Form DB] How to call submit_time](https://wordpress.org/support/topic/how-to-call-submit_time/)
 *  Thread Starter [antdigital](https://wordpress.org/support/users/antdigital/)
 * (@antdigital)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/how-to-call-submit_time/#post-8269047)
 * I’m trying to call it when a submission comes in. Calling the function inside
   _elseif ( $this->mail() ) {_ within the _submit()_ .

Viewing 4 replies - 1 through 4 (of 4 total)