• Resolved atifriaz56

    (@atifriaz56)


    Hello

    I need to add some custom logic after a form with a payment has been successfully submitted – I note that for some reason nearly all hooks/ actions like this have been removed – are there any left that I can hook into after a user has completed / submitted the form and made a successful payment?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @atifriaz56,

    You can use forminator_form_after_save_entry action for ajax based submission form and forminator_form_after_handle_submit action for non-ajax submission.

    Example usage:

    add_action ( 'forminator_form_after_handle_submit', 'my_form_submit', 10, 2 );
    add_action( 'forminator_form_after_save_entry', 'my_form_submit', 10, 2 ); 
    
    function my_form_submit( $form_id, $response ) { 
    
        if ( $response && is_array( $response ) ) {
             if ( $response['success'] ) { 
                if ( $form_id == 6 ) { 
    
    		// Code goes in here
    
                } 
            } 
        } 
    }

    I hope the above helps. Please do let us know if you need any further assistance.

    Best Regards,

    Nithin

    Thread Starter atifriaz56

    (@atifriaz56)

    Thanks @wpmudevsupport11

    But how to get the form submission data – we need either the entry ID or is there a way to the access this without a database call?

    Thread Starter atifriaz56

    (@atifriaz56)

    @wpmudevsupport11 To clarify – I want to run some additional logic after a form with a payment element is submitted … the logic involves storing some of the submission data in another custom table and also a means to get the remaining submission data at a later time.

    Therefore I need access to the submission data as soon as the form has been submitted and I assume I need to the form ID and entry ID to use :

    $entry = Forminator_API::get_entry( $form_id, $entry_id );

    to grab the submission data later (e.g. the next day)

    Any assistance is greatly appreciated as the docs are very limited with information

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @atifriaz56

    I pinged our our SLS Team so that they can review your query and see what will be possible in this case and how complex it will be. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @atifriaz56,

    You could try the function get_latest_entry_by_form_id and see whether that helps?

    Please check the following reference code as an example:

    add_action ( 'forminator_form_after_handle_submit', 'my_form_submit', 10, 2 );
    add_action( 'forminator_form_after_save_entry', 'my_form_submit', 10, 2 ); 
    
    function my_form_submit( $form_id, $response ) { 
    
        if ( $response && is_array( $response ) ) {
             if ( $response['success'] ) { 
                if ( $form_id == 6 ) { 
                    $entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( $form_id ); 
    
    
                } 
            } 
        } 
    }
    
    
    add_action( 'forminator_form_submit_response', 'save_fielder_details', 10, 2); 
    
    add_action( 'forminator_form_ajax_submit_response', 'save_fielder_details', 10, 2); 
    
    function save_fielder_details($response, $form_id) {
    
    
        return $response; 
        
    }

    Best Regards,

    Nithin

    Thread Starter atifriaz56

    (@atifriaz56)

    Thanks @wpmudevsupport11 and @wpmudevsupport13 ,

    I did consider this approach but did not want to rely on this in case the last entry was not the correct one (if high number of form submissions)

    I have opted to use the forminator webhook feature and send the data to the WP Rest API using a custom rest endpoint and function — this way I get the submission data however this feels very hacky, it would be really awesome and something which I am surprised is not being requested by every dev which is a hook after the form is submitted to get the submission data and do some additional logic — can I request this as a feature?

    Thanks

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @atifriaz56,

    Thanks for your feedback, I’ll make sure to bring this further to our developer’s attention to see what further improvements that could be considered in future regarding this.

    Best Regards,

    Nithin

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @atifriaz56,

    Could you please check and see whether instead of using:

     $entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( $form_id ); 

    The following works or not:

    $submitted_data = Forminator_CForm_Front_Action::$prepared_data

    Regards,

    Nithin

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @atifriaz56

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!

    Kind Regards,
    Kris

    Thread Starter atifriaz56

    (@atifriaz56)

    @wpmudevsupport13 – sadly forminator has proved too difficult to get working, bugs, customisation and flexibility, so I have deleted and gone for an alternative thanks for your help in any case.

    user $_POST to get all the form fields posted. Thats it

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @atifriaz56 ,

    We understand your decision. We hope you will give it a chance in the future as we strive to improve our plugin all the time.

    kind regards,
    Kasia

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Submission Hooks – any availlable’ is closed to new replies.