• I have a Forminator form that the user does the following:

    first page: The user enters a number and clicks next,
    second page: contains several forms equal to the number the user entered it includes basic information third page: contains a stripe payment

    My application logic involves taking this data and constructing an XML file to submit to some API when I get the last entry to parse and extract data using the attached code:

    	function forminator_form_after_save_entry( $form_id, $response ) {
    if( $response['success'] and $form_id == 6080 ){
    $entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( 6080 );
    error_log("XXX3:".print_r($entry, true));
    error_log("XXX2:".print_r($_POST, true));
    }
    }

    I get the following output:



    [16-Nov-2024 14:07:16 UTC] XXX3:Forminator_Form_Entry_Model Object
    (
    [entry_id] => 6
    [entry_type] => custom-forms
    [form_id] => 6080
    [draft_id] =>
    [is_spam] => 0
    [date_created_sql] => 2024-11-16 14:07:14
    [date_created] => 16 Nov 2024
    [time_created] => Nov 16, 2024 @ 2:07 PM
    [meta_data] => Array
    (
    [number-1] => Array
    (
    [id] => 44
    [value] => 3
    )

    [name-1] => Array
    (
    [id] => 45
    [value] => Array
    (
    [prefix] => Miss
    [first-name] => Rebecca
    [middle-name] => Joelle Clarke
    [last-name] => Alford
    )

    )

    [name-1-2] => Array
    (
    [id] => 46
    [value] => Array
    (
    [prefix] => Mr
    [first-name] => Sacha
    [middle-name] => Josiah Ewing
    [last-name] => Hayden
    )

    )

    [name-1-3] => Array
    (
    [id] => 47
    [value] => Array
    (
    [prefix] => Mr
    [first-name] => Jada
    [middle-name] => Cassady Powers
    [last-name] => Mueller
    )

    )

    [select-1] => Array
    (
    [id] => 48
    [value] => Option 2
    )

    [select-1-2] => Array
    (
    [id] => 49
    [value] => Option 2
    )

    [select-1-3] => Array
    (
    [id] => 50
    [value] => Option 2
    )

    [_forminator_user_ip] => Array
    (
    [id] => 51
    [value] => 127.0.0.1
    )

    [stripe-1] => Array
    (
    [id] => 52
    [value] => Array
    (
    [mode] => test
    [product_name] => Plan 1
    [payment_type] => One Time
    [amount] => 35.00
    [quantity] => 1
    [currency] => USD
    [transaction_id] => pi_3QLmeb2Lte7nQQ6y1fZ1OP6y
    [transaction_link] => https://dashboard.stripe.com/test/payments/pi_3QLmeb2Lte7nQQ6y1fZ1OP6y
    [status] => COMPLETED
    )

    )

    )

    [table_name:protected] => wp_frmt_form_entry
    [table_meta_name:protected] => wp_frmt_form_entry_meta
    )

    This makes it very hard to parse with complex logic, is there a way to get a better format? or i should build my own transformer?

    Ideally, I want:

    number user enter,
    array of entries
    strip related stuff

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

    (@wpmudev-support2)

    Hello @abdallahelhadad

    Hope you are doing well today.

    Unfortunately its not possible to access that data in a different format since it is stored in an object class so you can reformat it using your custom functions.

    You can use the json_encode() function to convert them to JSON format.

    Best Regards
    Amin

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.