Hello @smishra
I trust you’re doing well!
Please add the following code as a mu-plugin. Create a mu-plugins
folder if doesn’t exist, inside wp-content
. Create a forminator-response.php file and add the following code:
<?php
// Adds the "Custom ID" to fields selection.
add_filter(
'forminator_vars_list',
function( $vars ) {
$vars['custom_id'] = 'Custom ID';
return $vars;
},
15
);
// Filters the Success message and replaces the {custom_id} with the submission ID.
add_filter(
'forminator_custom_form_ajax_submit_response',
function( $response, $form_id ) {
$user_ip = Forminator_Geo::get_user_ip();
$last_entry = Forminator_Form_Entry_Model::get_last_entry_by_ip_and_form( $form_id, $user_ip );
$response['message'] = str_replace( '{custom_id}', $last_entry, $response['message'] );
return $response;
},
15,
2
);
Once the file is added, edit the thank you message in a form and add a Custom ID macro. Please see this screenshot:
https://take.ms/VoEfEo
Note that this code is required to read visitor’s IP address.
Hope this helps!
Cheers,
Nastia