Hi @hhentsch
Hope you are doing fine.
In order to add the submission id in the form, you’ll need to use custom code and also add a hidden field. This hidden field will store the submission id value and will be included as an additional column in the csv file.
You’ll need to add a must-use plugin to your site’s wp-content/mu-plugins folder as explained in our documentation here: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins, then add the following code provided to the plugin’s php file:
<?php
add_action( 'plugins_loaded', 'wpmudev_forminator_add_entry_id_to_hidden_field_func', 100 );
function wpmudev_forminator_add_entry_id_to_hidden_field_func() {
if ( class_exists( 'Forminator' ) ) {
class wpmudev_forminator_add_entry_id_to_hidden_field_func{
private $form_id = 327;//enter form_id here
private $entry_id;
public function __construct(){
add_action( 'forminator_custom_form_submit_before_set_fields', array( $this, 'retrive_entry_id' ), 10, 2 );
add_action( 'forminator_form_after_save_entry', array( $this, 'add_entry_id_to_hidden_field'), 10, 2);
}
public function retrive_entry_id( $entry, $form_id ){
if( $this->form_id == $form_id ){
$this->entry_id = $entry->entry_id;
}
}
public function add_entry_id_to_hidden_field( $form_id, $response ){
if( $this->form_id == $form_id ){
$entry_meta = array(
array(
'name' => 'hidden-1',
'value' => $this->entry_id
)
);
$entries = Forminator_API::get_entries( $form_id );
Forminator_API::update_form_entry( $form_id, $entries[0]->entry_id, $entry_meta );
}
}
}
$run = new wpmudev_forminator_add_entry_id_to_hidden_field_func;
}
}
– Adjust this line to match your form’s ID:
private $form_id = 327;//enter form_id here
– Add a hidden field to the form
– Adjust this line to provide the hidden field’s name:
$entry_meta = array(
array(
'name' => 'hidden-1', // adjust here
'value' => $this->entry_id
)
);
I ran a test on my lab site and got the following results:
https://snipboard.io/0WvkHB.jpg
When the CSV is exported, you can use the hidden field column to identify each of the submissions:
https://snipboard.io/FK6ZaP.jpg
Hope this information helps, feel free to reply if you have any additional questions.
Kind regards
Luis