frm_after_create_entry hook 1st line question

By: Michael Thena | Asked: 01/28/2024
ForumsCategory: Code Helpfrm_after_create_entry hook 1st line question
Michael ThenaMichael Thena asked 3 months ago
In most of the PHP hooks provided without support, there are numbers referenced in the first line, but not explained.  Similar number entries are explained later in each code snippet. What doe these 2 numbers represent.  Can someone please enlighten me on what 42, 2 are.  I'm assuming they would change based on something with my forms.   #add_action('frm_after_create_entry', 'after_entry_created', 42, 2);
#function after_entry_created($entry_id, $form_id){
#if ( $form_id == 5 ) { //change 5 to the ID of your form
#FrmEntryMeta::delete_entry_meta($entry_id, 30); // change 30 to your field id
2 Answers
Victor Font answered 3 months ago
The execution order of WordPress hooks can be prioritized. The first number, 40, is the priority. The default priority for all WordPress hooks is 10. The higher the number the later in the execution path the filter is processed. The second number is the number of parameters the filter passes to the callback. The first parameter is the returned value for a filter, actions do not return values. See this:
Michael ThenaMichael Thena answered 3 months ago
THanks for that - I've added it to my code snippets and verified my form and field ID are correct, but it's not deleting the checkbox response for the field ID I identified.  Or would it work better if it was a text field?
Victor Font replied 3 months ago

No, the field type shouldn't matter. If the metadata is not being deleted, are you certain the $entry_id is correct and that there's a value in the database that can be deleted for that entry. Formidable does not store values for which there is no default value or user provided values.

Michael ThenaMichael Thena replied 3 months ago

I'm trying to create a checkbox that would trigger an email, but NOT save so it's blank or unchecked the next time they go into the form to update it. So the checkbox is blank, they check it, update the file, it triggers the email, but then, hopefully, deletes the entry for that field so it's unchecked again next time they come in.

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