Last active
March 22, 2025 20:31
-
-
Save andrewjmead/a5ba8d613c90a800656ca74d015d5950 to your computer and use it in GitHub Desktop.
JetFormBuilder form submission hook for WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* JetFormBuilder has no documentation about what hooks they fire or when they fire them. | |
* | |
* I ended up digging into their source code to try and find an action that fires for all | |
* form submission, even if they don't have a custom "post submit action" set up. | |
* | |
* Using jet-form-builder/form-handler/after-send gets the job done. | |
*/ | |
add_action('jet-form-builder/form-handler/after-send', function ($form) { | |
if (!$form->is_success) { | |
return; | |
} | |
$form_id = intval($form->form_id); | |
$post = get_post($form_id); | |
if (is_null($post)) { | |
return; | |
} | |
$form_title = $post->post_title | |
// Success! | |
// Do something with form_id and form_title and other data on form... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@devab7 Needed same kind of thing with my form too:
I have a custom hook called check_email in JetFormBuilder. This hook checks whether an email exists in the database.
Expected Behavior:
If the email exists, the hook should return true (or "approved"), allowing the form to proceed with the next action.
If the email does not exist, the hook should return false (or "rejected"), preventing further actions from executing.
Issue:
I am unsure how to make JetFormBuilder process actions conditionally based on my hook’s return value. How can I return "approve" or "reject" and use this result to control form execution?
Any guidance would be appreciated!
But not able to find how to stop excution of form or conditonaily run a specific action based on Custom hook results?