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!
Hi,
Great plugin!
Just one question,
how can I add the survey in my sidebar? What the PHP/HTML code for it?
Thanks,
Alex
“Export to CSV” link doesnt work for me – i go to ’see all answers’ then ‘export to csv’ and it just gives me text on a web page… can anyone help me get around this and export to excel?
I don’t even have a CSV export link, button, or anything related to exporting the data. I am using the latest version of the plug in. Where would I find the export feature? Without the export feature, this plug in is not very useful to me. With the export feature, the plug is off the charts killer.
Go to Manage Surveys > Responses > Individual Responses > Export to CSV
Thank you. I hadn’t filled out any date for a survey, but now that I have the export link appears.
Ok, when I click on export I get a php file not a csv file. I’m guessing that you want to have people select all and then paste into notepad?
Dear Binny,
When I view the survey I’ve created in the Firefox, Opera or another browser it looks fine. When I switch to Internet Explorer not all the questions are displayed and the Submit-button is gone. This prevents people from submitting their answers. How can I fix this?
Kind regards,
Michiel
Hello,
Can you please confirm whether or not IP addresses or cookies can be tracked to ensure the same person doesn’t keep voting?
Thanks very much!
I can’t manage to get more than one survey to show up at a time? If you click “submit” on one, it submits them all. Help?
Great plugin. You can’t imagine how much it has helped my website.Thank you so much.
I’m not much of a programmer but I was wondering about a few things.
1) Adding a more secure “captcha” submit button.
2) I’m always worried about hackers and spam. Can the submit form ever be used to gain access to my website.
Thanks again,
Pete
One question. Is there a way to have the survey appear within a page and not a post? I have a client who is wanting a Members’ Survey page (not a post), and inserting the [surveyname] in the page HTML simply returns “[surveyname]“. I wanted to post up the question to see if there is a quick fix before I delve into the code.
You are using the wrong code. You should use [SURVEYS 1] – 1 being the id.
Actually, that is the code that is being used. When [SURVEYS 1] is entered, that is what is displayed when it is pulished. No survey, just the [SURVEYS 1] call.
Additionally, if I set up a new page or post with the [SURVEY 1] call, the survey will show in the preview, but will not display once the page or post is published.
Found the issue. There is a plug-in conflict with Wishlist Member. Any ideas for a solution?
I appreciate how easy it was to set up. I do have a feature request, if it’s simply to incorporate. I’d like to be able to send someone to a “thank you page” of my choice, so I can give a little “thank you gift” when they are done. And, of course, I’d like to be able to choose it for each survey and not globally.
Thanks for the great plugin!
Velma
This looks like what I’m looking for. My question is, if visitors want to see the survey results, is there a way that they can see the data, (Like 12 people answered questions #3 yes) or is it only viewable to the admin? I’d like to have everyone who takes the survey see the results- like the silly surveys that keep going around facebook… Thanks for your help!
It’s a great plugin, I like it very much.
Just have one question on it , that can I output all the questions in one ‘page’ without the [next] button?
It’s OK if it’s not supported currently.
Its possible. Go to admin > Settings > Survey Setting. Then set the number as 0.
We installed the survey plugin today and it’s installed and activated successfully, and we were able to create a survey using the survey manager, but nothing appears on the web site even with [SURVEYS 1] entered. We’re using the WP Remix theme. Does anyone know why the survey doesn’t work?
Is there a certain place it’s supposed to be placed? Waiting for help!
How can I place a certain survey in the sidebar?
Adding [SURVEYS #] by using the Text widget did not help…
That’s not possible in the current version of the plugin.