The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Can't Find Hooks for Form Save or Duplicate

Labels

This Discussion is public

Notifications

How can I make changes in WP based on when a new form is created by saving a new one or duplicating an existing one?  I expected a filter or action would exist I can use as a hook.  I am already doing this with Gravity Forms and thus far have found Formidable to be as robust but I can't for the life of me figure out how to know when a new form has been saved/duplicated/published.  What am I missing?

Please help!

Are you talking about the form itself or a form entry?

If you're asking about the form itself, then it's published when you click the create button when building the form. If you don't want to publish the form, use the Save Draft button.

To duplicate a form, you hover over a form title and click the Duplicate Form link. The copied form will open in the form builder. The same 2 buttons as above apply.

Does that answer your question?

Thanks @vfontjr but I'm talking about the form itself and I'm not interested in what can be done with the UI.  I actually need to programmatically be made aware of new forms created for a plugin installed that works with Formidable and other form builders.  Specifically I need a hook that can run a function when a new form is created.  I hope that helps clarify.

That makes a difference. Thanks for clarifying.

I had to dig through the Formidable source code. The functions that create and duplicate forms are in formidable⁩/classes⁩/⁨models⁩/FrmForm.php. The functions are create and duplicate respectively.

None of this is documented, but when I look through the source I see that each function has 1 hook that you may be able to utilize. Create has the frm_form_options_before_update filter that is applied right before the new form is inserted into the db. Duplicate has the frm_after_duplicate_form action that is called before the function ends.

You're really on you own to figure out if these will work for you.

@vfontjr, thanks for sending those functions from formidable⁩/classes⁩/⁨models⁩/FrmForm.php.  I wasn't able to make the frm_after_duplicate_form action work but if anyone else is reading this, I was able to easily add the frm_form_options_before_update filter and use it as a hook even though it is not documented.  Unfortunately, since it doesn't actually call the filter on create or duplicate like I wanted, it's not as helpful as Gravity's API and ultimately I may have to rely on a cron scheduler to meet some of my needs regarding Formidable but it is certainly better than nothing.

If Formidable reads this, please take this as a suggestion/request...we could use a well documented method for hooks on forms and not just their entries/views/actions/etc.

Best of luck all!

Discussion closed.