• Resolved sigrono

    (@sigrono)


    Hello,
    I’m really interested in using this plugin and I wondered if it is possible to somehow catch the data via a hook in php when the form is submitted without interfering the email. I saw in the API that it is possible to get form data in an array with an ID after the form has been submitted, but is it also possible to get the array right after the form is submitted, so without asking with the ID?

    To be exact: is it possible to somehow catch the form data after submit in your Forminator Plugin? So one could save them into an external database without saving to the wordpress db and then requesting it? So on submit run script with data from the form.

    As already suggested by the social media team, here are some way to go.

    1) First option would be to disable form submission storage on the database from the form settings and using Zapier integration to send data to an external database.

    2) The second option would be to create a new extension using the API. We have detailed docs here:

    https://premium.wpmudev.org/docs/api-plugin-development/forminator-api-docs/

    3) The third option would be to use forminator:form:submit:success hook to post formData to any other database

    I would prefer the second or last option. Therefore my question is, how do I hook the submitted data? Which variables are already set and how can I read the submitted form data?

    add_action( 'forminator:form:submit:success', function ($form) {
    
        $formid = $form['ID'];
    
        if($formid == 3000){
        include("../xyz.php");
        }
    
    //how do I get the ID or the form data from this hook? The function above shows would I like to do at the end and then use the data in the included php file via $form['name']; etc...
    
    });

    Many thanks!

    #Info: I closed the other topic to make the thread cleaner

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @sigrono ,

    I have checked with the developer and right hook for PHP is forminator_custom_form_submit_before_set_fields (forminator:form:submit:success is for JS).

    /**
    * Action called before setting fields to database
    *
    * @since 1.0.2
    *
    * @param Forminator_Form_Entry_Model $entry - the entry model
    * @param int $form_id - the form id
    * @param array $field_data_array - the entry data
    *
    */
    do_action( 'forminator_custom_form_submit_before_set_fields', $entry, $form_id, $field_data_array );

    $field_data_array contains submitted data.

    kind regards,
    Kasia

    Thread Starter sigrono

    (@sigrono)

    Hi Kasia,
    thanks for your reply. I’m just not quite sure about the $entry? How do I define that variable? Is it set by default? All other variables are clear.
    Thank you very much!

    Thread Starter sigrono

    (@sigrono)

    Okay got it thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Catch data on submit to transfer into another db’ is closed to new replies.