PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Display Poll Results

  1. Is there anyway to simply display the results of a poll without the user needing to click View Results?

    Basically, I want to do exactly what the Polls Widget does when Display Mode is set to Results.

    The issue I'm having with doing it via the View Results link on the poll is that if I have a multi-paged poll, the View Results link doesn't show up until the last poll in the form.

    I tried using gpoll_get_results() but apparently I don't know what I'm doing as that created an error stating the function doesn't exist, I guess because it's just inside of the widget...

    Any ideas?

    Posted 6 years ago on Wednesday January 9, 2013 | Permalink
  2. Managed to put this together which is working for me:

    [php]
    <?php the_widget('GFPollsPollWidget', 'form_id=1&showtitle=1&&mode=results'); ?>

    If anyone knows of a better way, I'm still all ears.

    Posted 6 years ago on Wednesday January 9, 2013 | Permalink
  3. That does not look like a bad way of doing it, especially if it works for you. I will send this to the developer of the polls add-on and see if he has any concerns.

    Posted 6 years ago on Wednesday January 9, 2013 | Permalink
  4. Thanks Chris - looking back through the documentation today I found the right way to do it via the shortcode:

    echo do_shortcode('[gravityform action="polls" id="1" mode="results" style="green" cookie="1 month" show_results_link="true" display_results="true" percentages="true" counts="true"]')

    Or if you want to use it in your theme files:

    <?php echo do_shortcode('[gravityform action="polls" id="1" mode="results" style="green" cookie="1 month" show_results_link="true" display_results="true" percentages="true" counts="true"]'); ?>

    I swear I read that documentation three times yesterday and never saw it. My. Bad.

    Posted 6 years ago on Thursday January 10, 2013 | Permalink
  5. No problem. There are multiple ways to do it. Glad you have it working.

    Posted 6 years ago on Thursday January 10, 2013 | Permalink