frm_after_update_entry not firing on first pass on form update, user registration update is not updating

By: Jay Mac | Asked: 11/18/2023
ForumsCategory: General questionsfrm_after_update_entry not firing on first pass on form update, user registration update is not updating
Jay Mac asked 1 year ago
I have two snippets that update non-word press tables that use frm_after_update_entry. Both forms update different user_meta fields in the logged in wp user profile. The snippet for these forms (if test of form key determines which db table is updated) does not fire the very first time I update the data either form (the defaults for the fields are set for the current user_meta) and the user profile is not updated. The form entry is correct for each form on the first pass through. I have my user registration action set for Entry is Created, Entry is Updated. The 2nd time I update the form all entries, the user profile are all updated correctly and the snippet fires.

This is driving me crazy and formidable is no help since this is "code" and it just too difficult and time consuming to get them to walk through the setup required to get to these update forms.

Has anyone else experienced anything like this? Any solutions
Rob LeVineRob LeVine replied 1 year ago

Two questions: 1. When you say "update the data" how are you updating it? If it's not via a form submission (via editing the entry), the frm_after_update_entry won't be called. 2. Are you sure that the hook isn't being called or could it be that it's called and just not doing what you want, i.e., did you put any debugging code in the hook? I have to be honest that "not getting called the first time" doesn't really resonate with something that can happen.

2 Answers
Jay Mac answered 1 year ago
Ok - frm_after_update_entry doesn't work. It appears I did not understand that the frm hook is tied to each form and its entry state. If there are not entries then it won't fire the frm_after_updat. Also the 2nd form I only had Entry is Updated for the form action. With both form actions set to Entry is Created, Entry is Updated and the snippet changed to frm_after_create_entry instead of frm_after_update_entry users, forms and snippet are working as expected.
Rob LeVineRob LeVine replied 1 year ago

I guess you're saying you solved it, but I do want to make you aware that the form actions have nothing to do with whether the hooks get called, that's only to tell the form when to send notifications.

Paul Bruikman answered 1 year ago
Looks like you are dealing with only one form. It depends on what you are doing. If it is from form A to form A then it should work. But if you use something from form A to form B it probabley won't.
From A to B frm_after_create_entry
frm_after_update_entry
On form A
The registration triggers the actions for form A But if you use a script to copy data then chances are that registration does not fire beacuse it is triggered by the edit entry date of form B.
I used these functions to update some fields in entry in a client data form (from form A to form B). The registration action of form B then does not trigger but it does if I also copy the update date of form A to form B.

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