• Resolved angelamd59

    (@angelamd59)


    At the moment I use the Forminator free plugin and e2PDF plugin for responding to the submitted form. The sequential numbering on the form submission suddenly stopped working a few days ago. The forms submitted up to the 3rd of July 2023 were working fine, then the forms submitted from the 6th onwards stopped using the numbering – instead showing the macro text on the hidden field. The support WPMU DEV team supplied me with a custom snippet a couple of years ago: Here is the php code which was added to the mu-plugins folder in the site files

    <?php
    
    add_filter( 
    	'forminator_custom_form_submit_field_data',
    	function( $field_data_array, $form_id ){
    
    		// We're using a custom macro <code>AUTOINCREMENT_INT</code> set as value for a field.
    		// Make sure you add this value only in hidden fields
    		$needle      = 'AUTOINCREMENT_INT';
    		$incremental = get_post_meta( $form_id, 'autoincrement_int', true );
    		$update_meta = false;
    
    		foreach ( $field_data_array as $key => $field_data ) {
    			if ( isset( $field_data[ 'value' ] ) && $needle === $field_data[ 'value' ] ) {
    
    				if ( ! $incremental ) {
    					$incremental = 1;
    				} else {
    					$incremental++;
    				}
    
    				$field_data_array[$key][ 'value' ] = $incremental;
    				$update_meta                       = true;
    			}
    		}
    
    		if ( $update_meta ) {
    			update_post_meta( $form_id, 'autoincrement_int', $incremental );
    		}
    
    		return $field_data_array;
    	},
    	20, 
    	2
    );
    
    add_filter(
    	'forminator_custom_form_mail_admin_message',
    	function( $message, $custom_form, $data, $entry ){
    		$incremental = get_post_meta( $custom_form->id, 'autoincrement_int', true );
    		if ( is_numeric( $incremental ) ) {
    			$message = str_replace( 'AUTOINCREMENT_INT', $incremental, $message );	
    		}
    		return $message;
    	},
    	10,
    	4
    );

    In the Forminator form, I added a Hidden field which has the Type as Custom, and this macro was added as the value – AUTOINCREMENT_INT;

    In the e2PDF I added a new HTML field and mapped it to {hidden-1}. Every new submission was automatically numbered by +1 in the field I added in the PDF invoice, as well as the Forminator Submissions section of the form. Here is the quick video I was given https://monosnap.com/file/OKEqRE2kkXwVyuCqCrRUXpsUSse1lM. So basically I am reaching out to see if anyone else is having this problem or if anyone has a solution.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Sequential numbering on the Forminator form submission suddenly stopped working’ is closed to new replies.