Correct hook to use after frm_add_entry_meta

By: Tom Boltwood | Asked: 12/14/2022
ForumsCategory: Code HelpCorrect hook to use after frm_add_entry_meta
Tom BoltwoodTom Boltwood asked 1 year ago
I want to send some data to an API. I would usually use the 'frm_after_create_entry' hook. However, in this case, I'm doing some calculations based on the answers to add to a hidden field for which I'm using the 'frm_add_entry_meta' hook. The issue I'm having is that the 'frm_add_entry_meta' hook seems to be called after the 'frm_after_create_entry' hook, so the calculated score is not in the hidden field. What hook should I use, or how else should I go about it?
1 Answers
Victor Font answered 1 year ago
I ran into an issue with frm_add_entry_meta on a client's site. While testing this filter with code found in the Formidable Knowledgebase, it did not work as advertised. The issue sounds similar to yours where I was adding a value, but nothing would display in the view or on the form afterward. What I discovered is that there is no check to see if the entry meta already exists in the database. Running the filter over and over resulted in multiple repeated values for the single entry meta field on a single post. You have to use PHPMyAdmin and search the frm_item_metas table to see the multiple values. When displayed in a view or on a form, only the first value displays. Before using frm_add_entry_meta, include a condition that checks if the field already exists in the table. If it does, use frm_update_entry_meta instead.
Tom BoltwoodTom Boltwood replied 1 year ago

Thanks, that's useful to know. It seems I can manipulate the value using the 'frm_pre_create_entry' hook, so I'm using that, followed by 'frm_after_create_entry' and ignoring the frm_add_entry_meta one altogether.

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