Surveys WordPress Plugin
By Binny V A • Nov 20th, 2008 • Category: Blogging, Scripts, WordPress
The Surveys WordPress plugin lets you add surveys to your blog. You can let the visitors take surveys and see the result from the admin side. The user who take the survey can enter their details at the end of the survey – or leave it as an anonymous result.
If you are new to this blog, this is the Plugin Week. I am going to release one wordpress plugin each day, every day for one week(ie. Monday to Friday). Each day you will get a new plugin by me. This is the fourth plugin in this series. The earlier ones were…
Note: Surveys is a beta plugin(as are most of the plugins released in the Plugin Week) – so watch out for bugs. And trust me, there will be a lot of them.
Usage/Screenshots
First, Download, install and activate the Surveys plugin. Then go to Manage > Surveys section to create new surveys – or edit existing ones. After creating a survey insert the HTML comment [SURVEYS 1] into a post. Here, the 1 should be the ID of the survey you want to insert into that post.


The client side of the plugin will look something like this – your visitors will see this part…

You can see the result of the survey from the admin side – there are two ways to see the data…
Aggregate
This will show the results each question by aggregating all the data so far. This will look like a poll result. This mode is useful to make decisions – you can immediately see the most favored answers for each question.

Individual Responses
You can also view all the answers provided by each visitor one by one. This mode has its uses as well.

See it in action
I have set up a demo for Surveys over at BinnyVA WordPress demo blog. Take a look.
Feedback
If you have any suggestions or notice any problems with the plugin, post it in the Surveys forum. I’ll take a look at it – as soon as the Plugin Week is over – I am way too busy right now
Next plugin – will be released tomorrow.
Bin-Blog
Follow me(@binnyva) on Twitter
Ah never mind Binny, I found it in show_survey.php.
If anyone else needs it, add:
foreach($_POST['question_id'] as $question_id) {
if(!$_POST['answer-' . $question_id]) { echo “Sorry, you did not answer the following questions: $question_id. All questions are required. Please try again.”; }
}
after this line in show_survey.php
if(isset($_POST['action']) and $_POST['action']) {
and go back to them form
I like this idea a lot but when I do as you say I get an error…
Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /home/orvzauhv/public_html/neweraconsulting.co.uk/wp-content/plugins/surveys/show_survey.php on line 16
Any help appreciated or even better how could we get it to stop the person moving to the next page if they haven’t answerd all the qustions
Thanks..
Thank you for a great plug-in !
There’s one thing that would ‘fit’ your plug-in… when ‘focusing’ on the user-answer (with a radio/checkbox in front)… the checkbox/radio should automatically get ‘checked’ without the user’s input.
A simple 1-liner can do this (maybe someone else is interested in this so I’m posting it here)
jQuery("input.user-answer").focus(function() { jQuery(this).prev().attr('checked', true); });Just add it (inside script.js) above:
jQuery("#survey-next-question").click(nextQuestion);Have a great day
Thanks – I made the change – it will be there in the next version.
On my site, only logged in users see the posts that have surveys. I’d like to make it so that the login information is captured (instead of people having to provide it) and that they only get the survey once. Can you point me in the right direction for making these changes?
I would like to export the data as a CSV file, however, it is exporting as a PHP file. The software even asks to export as a CSV file. Please help. Thanks!