Hi @verdut
I hope you are doing good today.
I pinged our Forminator & SLS Team to review your query. We will post an update here as soon as more information is available.
Kind Regards,
Kris
Hi again @verdut
You can use the “forminator_poll_submit_response” filter to get form response and form id. Example:
add_filter( 'forminator_poll_submit_response', function( $response, $form_id ) {
return $response;
}, 10, 2 );
Kind Regards,
Kris
Thread Starter
verdut
(@verdut)
Hello. Thank you for the answer. But I’m having difficulties. In the $response variable as I could see there’s a message field that tells me if the vote has been saved or not, a notice and a success values.
I need to get the answer that the user voted for. If let’s say the poll has 2 possible answers, Answer A and Answer B, when the user press Answer A, I need to get from the filter or the action, Answer A. Maybe I don’t know how to read the $response variable properly.
Also, I figured out I have another question. I hope you can answer it here too. Is there also any filter or action that triggers when a poll is published in the wp admin area and also that gives the data of the poll created ? Like the title of the form and the answer options ?
Thread Starter
verdut
(@verdut)
Slight edit. When the user submits Answer A.(not on press, as mentioned above)
Hi @verdut
Can you try this alternative?
<?php
add_filter( 'forminator_polls_submit_field_data', function( $field_data_array, $form_id ) {
return $field_data_array;
}, 10, 2);
https://monosnap.com/file/BZ3tPtoVirHo7Yd5hcAhRdnLJ3eR0E
The first item in the array is the alternative voted.
Best Regards
Patrick Freitas
Thread Starter
verdut
(@verdut)
Thank you very much. It works.