Ask your WordPress questions! Pay money and get answers fast! (more info)

I need a Polls plugin

  • SOLVED

Hi guys

Do you know a polls plugin with these requirements:

1- I have a CSV file with 100 items. I need to import this csv file into the plugin. This file will be transformed into a poll with 100 choices (1 item csv = 1 choice in the poll)

2- I need to display results like Donut Chart or something like that.

3- The user should be able to select several answers.


Thanks for your help



PS : for Lawrence, the Top 10 Experts in homepage seems buggy. No ?

Answers (2)

2016-12-20

Kyle answers:

Gravity Forms would work

They have a polls, survey, and quiz add-ons if you want to try those, and there are also some 3rd party chart add-ons. Likewise you can bulk import a field's options (could even save it as a custom pre filled value and make a few different forms).

https://gfchart.com/
https://gravitywp.com/pie-chart-gravity-forms/


Sébastien | French WordpressDesigner comments:

oh... cool ... Do youknow which add-on could transform a csv file into a poll ?


Kyle comments:

That wouldn't be an add-on, GF can do something like that by default. Can I ask how you are using the CSV? Is it a file you want to regularly update and reupload, is it just something you want to handle quickly one time? Would you rather just copy and paste them all at once...


Sébastien | French WordpressDesigner comments:

Yes it is a file i want to regularly update and reupload


Kyle comments:

Okay, yes GF would work. The easiest solution though would probably be a PHP function. Gravity Forms has a pre_render filter that would allow you to set the field choices from a field. Then you pull the choices from an uploaded file, and whenever you want to upload new ones, you just upload the file to the same place and override the old one.


Sébastien | French WordpressDesigner comments:

I don't want override the old file. I need write a new and I want to keep the old.
So, GF does not have the function to import. I need to write a function ?


Sébastien | French WordpressDesigner comments:

I have buy GF. How can I create a poll with GF ?


Sébastien | French WordpressDesigner comments:

I hope that your response is not "http://www.gravityforms.com/add-ons/polls/"
because I see now here http://www.gravityforms.com/add-ons/ that this add-on is avalaible only with developper licence (199$ !)...
so : By following your advice, have I spend 39$ for nothing... ?


Sébastien | French WordpressDesigner comments:

The support of GF confirm : it's not possible to import in CSV...
I have spend 39$ for nothing...


Kyle comments:

You can just use a normal checkbox field as your poll and then use

https://wordpress.org/plugins/gf-charts-reports/

For your piechart.

Then, like I said in my reply, you would use pre_render to populate your checkbox field with your CSV upload.

It will be something like this (goes in your functions.php file)


add_filter( 'gform_pre_render', 'populate_checkbox' );
add_filter( 'gform_pre_validation', 'populate_checkbox' );
add_filter( 'gform_pre_submission_filter', 'populate_checkbox' );
add_filter( 'gform_admin_pre_render', 'populate_checkbox' );
function populate_checkbox( $form ) {

foreach( $form['fields'] as &$field ) {

//NOTE: replace 3 with your checkbox field id
$field_id = 3;
if ( $field->id != $field_id ) {
continue;
}

//Change to where ever you upload your csv and whatever the name of it is
$csv = 'http://wpquestions.com/wp-content/themes/my_csv.csv';

$posts = array_map('str_getcsv', file( $csv ));

$input_id = 1;
foreach( $posts as $post ) {

//skipping index that are multiples of 10 (multiples of 10 create problems as the input IDs)
if ( $input_id % 10 == 0 ) {
$input_id++;
}

$choices[] = array( 'text' => $post->post_title, 'value' => $post->post_title );
$inputs[] = array( 'label' => $post->post_title, 'id' => "{$field_id}.{$input_id}" );

$input_id++;
}

$field->choices = $choices;
$field->inputs = $inputs;

}

return $form;
}


Sébastien | French WordpressDesigner comments:

OK... this code doesn't work completely (value not displayed) but i'm ok with this idea.

Could you write this code ? And add a button ? something like "import a csv" ...

With the present code, each new form is populated with the csv.
I need choose which form is populated by which csv (sorry, not sure that my english is good).

And what's your fee for this little job ?


Kyle comments:

If you just wanted to use the above for each form, you still can you would copy and paste the function and add


if( $form['id'] == 1){
$csv = 'http://wpquestions.com/wp-content/themes/my_csv.csv';
}
if( $form['id'] == 2){
$csv = 'http://wpquestions.com/wp-content/themes/my_csv_2.csv';
}


I could write a button for you though if you prefer that, I will send you a PM


Sébastien | French WordpressDesigner comments:

yes, send me a mp :)))

2016-12-20

Jarret Minkler answers:

https://wordpress.org/plugins/cp-polls/ Should work?

For import - https://wordpress.org/plugins/wp-ultimate-csv-importer/ you shouldn't mix the 2 operations I think ..


Sébastien | French WordpressDesigner comments:

wp-ultimate-csv-importer import CSV as poll ?! Have you try ?


Sébastien | French WordpressDesigner comments:

I havve try. That doesn't work.


Jarret Minkler comments:

No first link is for polls

Second link if for dev import to database

You aren't going to find one plugin that does both

You choose your polls plugin, and then you populate with dev to database plugin