any document of the timing of hooks?

By: Larry Kolinek | Asked: 04/18/2023
ForumsCategory: General questionsany document of the timing of hooks?
Larry Kolinek asked 2 years ago
The AI element is not using/doing the same hooks as a typical FF form?   I'm trying to get the values from a watched fields, but not able to do that :(   Surely I would think a hook, after the submit happens would work, but its not:
i tried:
add_filter( 'frm_field'

add_action('frm_after_create_entry'  and looking into others...  
1 Answers
Victor Font answered 2 years ago
There's only one hook in the AI add-on. If you want to get an idea of hook firing, I suggest this plugin: https://www.oik-plugins.com/wordpress-plugins-from-oik-plugins/free-oik-plugins/oik-trace-plugin/an-introduction-to-problem-determination-with-oik-bwtrace-debug-trace-for-wordpress/
Larry Kolinek replied 2 years ago

<p>Thanks Victor, I installed that OIK plugin, turned on/check lots of check boxes... only spent a few minutes trying to understand it... But no luck 🙁 It seems I need to read a lot, to figure out how to make it work? So, that in itself, seems like a project 🙂 that I don't want to do. Have you used it before? I looks great, but don't want to spend the time if it is problematic. FYI. on the AI element, I found a bug that FF is working on. AND I got feedback that, yes, the AI element works differently than ALL other standard forms :(</p>

Victor Font replied 2 years ago

I tend to use Kint as my primary debugger with WordPress/Formidable these days. Query Monitor is also pretty good, but with SQL I prefer explain plans generated by the engine. The oik plugin is on my development environment, but I can't remember when I last used it.

Kint is s a great tool for testing code and values. Kint can display anything in the WordPress globals, including filters and actions. Understanding the WordPress globals is key to understanding how WordPress executes code. All WordPress Actions and Filters, of which Formidable's are a subset also dependent on WordPress globals like $wpdb.

Here is some information about the WordPress global $wp_filter. This global variable keeps track of the execution order: https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/. This is the information about how WordPress keeps track of all add_action and add_filter callback functions and their timing parameters.

This could give you what you need to know, or it may not. When I test actions and filters, I use really simple stub functions. With Kint you can test all of Formidable's hook parameters to see exactly what Formidable is using to trigger its surrounding core code. All of this transparency is available through the WordPress Hooks API. If you want to know about timing, send a a hook identifier and timestamp to debug.log. You can log anything when testing code. I wouldn't do this in a production environment, though. Lol!

I Think you're going to like Kint. The version written by Tonya Mork, which I use, is a little outdated. She works pretty much now full time developing WordPress Core Code. Her plugin in the WordPress repository doesn't work with PHP 8+ unless you change 2-lines of code. Each is an array that is initialized with {} instead of []. PHP 8 dropped curly braces to initialize arrays. I fixed it in my dev environment. Here's a link to my version: https://vfcgdownloads.s3.amazonaws.com/kint-php-debugger.zip

Larry Kolinek replied 2 years ago

thanks for all the details!!!

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