• I am using the “Serial Number for Contact Form 7” plug-in to set serial numbers,
    Even if a validation error occurs when entering the form, the number will increase,
    There will be a missing number in the serial number of the email that was sent normally.

    It seems that the Contact Form hook increments the serial number,
    It seems to be the cause that this works even with validation errors.

    I temporarily fixed it by making the following corrections,
    Do you have any concerns?

    I hope the plugin will be updated.

    serial-number-for-contact-form-7/includes/submission.php:

    add_action( 'wpcf7_submit', 'nt_wpcf7sn_submit', 10, 2 );

    function nt_wpcf7sn_submit( $contact_form, $result ) {
    
    	// ---- Add
    	if ( $contact_form->in_demo_mode() ) {
    		return;
    	}
    
    	$cases = array( 'spam', 'mail_sent', 'mail_failed' );
    
    	if ( empty( $result['status'] )
    	or ! in_array( $result['status'], $cases ) ) {
    		return;
    	}
    
    	$submission = WPCF7_Submission::get_instance();
    
    	if ( ! $submission
    	or ! $posted_data = $submission->get_posted_data() ) {
    		return;
    	}
    
    	if ( $submission->get_meta( 'do_not_store' ) ) {
    		return;
    	}
    	// ---- /Add
    
    	$form_id = intval( $contact_form->id );
    
    	// メールカウントの更新
    	NT_WPCF7SN_Form_Options::increment_count( $form_id );
    }
  • The topic ‘missing number in the serial number’ is closed to new replies.