• Resolved Fulgence Ridal

    (@theeponymus)


    Hello,

    I have many polls created with forminator and I would like to have a php access to the results.
    My question is quite simple : Is-it possible ?

    Cos’ I’ve tried a lot a thing with API and it seems it is not possible…

    thx

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello @theeponymus

    I trust you’re doing well!

    I’ve forwarded your question to our developers. Once there will be an update we will follow back in this thread.

    Kind regards,
    Nastia

    Hello @theeponymus

    I trust you’re doing well!

    Our developers provided the following mu-plugin. Please add it to wp-content/mu-plugins/ directory.

    <?php
    $polls = Forminator_API::get_polls();
    
    foreach ( $polls as $poll ) {
    	$chart_data = forminator_get_chart_data( $poll );
    }

    The Forminator_API::get_polls() will get a list of all polls and return an array of poll objects which are required to get data from forminator_get_chart_data.

    Having those you should get arrays like this:

    array(2) {
      [0]=>
      array(3) {
        [0]=>
        string(3) "label one"
        [1]=>
        int(2)
        [2]=>
        string(23) "rgba(54, 162, 235, 0.2)"
      }
      [1]=>
      array(3) {
        [0]=>
        string(3) "label two"
        [1]=>
        int(3)
        [2]=>
        string(23) "rgba(255, 99, 132, 0.2)"
      }
    }

    in those, you can find labels, votes number, and bar color.

    Let us know if you still have any further questions.

    Kind regards,
    Nastia

    Thread Starter Fulgence Ridal

    (@theeponymus)

    It works !

    thx a lot Nastia

    Hello @theeponymus

    I hope you are doing well!

    Glad to know that all is well!

    I’ve marked this ticket as resolved. If you do have any followup questions or require further assistance feel free to reopen it and let us know here.

    Kind regards,
    Nastia

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How can I have access to the results’ is closed to new replies.