Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter theparzival

    (@theparzival)

    After reading documentation, I Found the solution. Below is the code I am using to generate unique id for each form.

    
    /**
     * WPForms, Generating Individual Unique ID for a Form
     *
     * @param array $fields Sanitized entry field values/properties.
     * @param array $entry Original $_POST global.
     * @param array $form_data Form settings/data
     * @return array $fields
     */
    function be_wpforms_update_total_field( $fields, $entry, $form_data ) {
    
    	// Only run on my form with ID = 14501
    	if( 14501 != $form_data['id'] )
    		return $fields;
    
    	// Calculates total entries in a particular form and adds one to it
    	$fields[3]['value'] = wpforms()->entry->get_entries( array( 'form_id' => 14501 ), true ) + 1;
    
    	return $fields;
    }
    add_filter( 'wpforms_process_filter', 'be_wpforms_update_total_field', 10, 3 );
    
Viewing 1 replies (of 1 total)