Duplicate Form Entries

By: Naomi Spirit | Asked: 02/22/2024
ForumsCategory: General questionsDuplicate Form Entries
Naomi SpiritNaomi Spirit asked 9 months ago

I have recently started experiencing duplicate form entries on a simple formidable form.  I've taken the advice here https://formidableforms.com/knowledgebase/why-am-i-receiving-duplicate-entries/ and have discovered that it only happens when the plugin I have made myself is active.  So need to get to the root cause of why. In my plugin this is the code:

//
add_action('frm_after_create_entry', 'tw_form_submitted', 30, 2);

function tw_form_submitted($entry_id, $form_id ){
 switch ($form_id){
    case tw_get_signup_form_id(): 
     
      tw_add_meta_to_user( $entry_id, $form_id );
      tw_add_user_game_list($entry_id);
      tw_mp_send_welcome_email($entry_id);
      
      break;
}

In the example, the function tw_form_submitted is getting called twice.

I didn't notice exactly when this started occurring but I haven't changed any of this code which was previously working.  In that time there have been some plugin updates. I tested on staging and the issues occurring.  I followed the instructions on how to check for a database issue and tested it the issue still occurs.

 So the next step is to add in one of the filters to check for duplicate entires but obviously would prefer to know why its happening.  

Also in the filter its unclear what the time limit should be.  Is this a value in milliseconds?

add_filter('frm_time_to_check_duplicates', 'tw_change_duplicate_time_limit_one_form', 10, 2);
function tw_change_duplicate_time_limit_one_form( $time_limit, $entry_values ){
if ( $entry_values['form_id'] == 100 ) { //change 100 to your form ID
$time_limit = 0;
}
return $time_limit;
}
1 Answers
Victor Font answered 9 months ago
First of all, you didn't write a plugin. You have written a call back function for the frm_after_create_entry action. It's impossible to say what's wrong because you are calling 4 other custom functions that can't be seen and there are no comments in the code. If you want to post all of your source code so someone can actually take a look at what might be wrong, please create a pastebin and post the link back here.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right