Surveys WordPress Plugin

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.

About Binny V A 102 Articles
Freelance Web Developer on the LAMP Platform. Maintains a blogs http://blog.binnyva.com/. Other sites include Bin-Co and OpenJS

72 Comments

  1. Hi, I installed the plugin in WP 2.71 and get this error:

    WordPress database error: [Table 'wpdb.wp_surveys_survey' doesn't exist]
    INSERT INTO wp_surveys_survey(name,description,status,added_on) VALUES('Schoonmakers','Hoe schoon is onze binnentuin?','1',NOW())

    what do I do?

    • Try deactivating and re-activating the plugin. The error is caused because the plugin was unable to create the database table automatically. Could be a permission issue for the database user.

      • Hmm, did that now I get:

        Fatal error: Cannot redeclare surveys_add_menu_links() (previously declared in /var/www/wp-content/plugins/surveys/trunk/surveys.php:17) in /var/www/wp-content/plugins/surveys/surveys.php on line 23

  2. I get the same error on 2.7.1 as well, I’ve deactivated and re-activated the plug in. Its not a permissions issue, the database user has all privileges. I really like this plugin and would like to use it, but need to resolve these errors.

  3. Hi Binny V A,

    I tried to install you survey, but get a 404 error when I create a new survey. I suspect it has something to do with moving my site’s URL location to the root directory (sorry-I am sketchy on the details of what I did or how I did it (it’s been a while)–i just set it so the URL appears to come from my root domain instead of my install folder).

    I’m excited about this plugin. Any ideas?

    Thanks,
    Jeff Hajek

    • Just an update.

      I got this working by tinkering with the code. Basically, I just kept searching the php files for references to “wp-admin” or similar directories, and adding in my own directory. Eventually I hit on the right combo (can’t quite recall which files had the magic touch), and got it working

      Works great now.
      Thanks.

  4. I started experimenting with your Surveys plugin in WP 2.7 and ran into problems when assigning questions. Turns out the problem was your use of short php tags in a couple of places in the question.php file. If you do a search for those short php tags and replace them (don’t remember if there were two or three), it so far seems to work in 2.7.

  5. How can I limit the number of times one PC can vote? via cookie or IP.

    It’s really important, otherwise the system is easily gamed.

  6. I was wondering if you could help me figure out what the following error means?

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ” at line 3]
    SELECT Q.ID,Q.question,(SELECT COUNT(*) FROM wp_surveys_answer WHERE question_id=Q.ID) AS answer_count FROM wp_surveys_question AS Q WHERE Q.survey_id=

  7. Hi,
    Is there anyway to share one survey on many diferent posts but having responses with the ID of the post?

    thanks

    cedric

  8. If I want to display the survey someplace other than in a post, maybe the default.php file. Is there a PHP command I can use to call the function? and the survey will appear.

    Thank you!

  9. I attempted the plug-in on my site but was un-luckily did not suceed fully.I will require your help in achieving success.I followed procedure as given but did not succeed?Is the survey ok with word-press version 2.8.
    I uploaded content to /wp-content/plugins/folder activated the plug-in and then went to settings and clicked on surveys setting which resulted in to following error message. pls respond.Thanks.

    Warning: require() [function.require]: Unable to access /home/vhosts/technical-world.freevar.com//wp-content/plugins/surveys/options.php in /home/vhosts/technical-world.freevar.com/wp-content/plugins/surveys.php on line 56

    Warning: require(/home/vhosts/technical-world.freevar.com//wp-content/plugins/surveys/options.php) [function.require]: failed to open stream: No such file or directory in /home/vhosts/technical-world.freevar.com/wp-content/plugins/surveys.php on line 56

    Warning: require() [function.require]: Unable to access /home/vhosts/technical-world.freevar.com//wp-content/plugins/surveys/options.php in /home/vhosts/technical-world.freevar.com/wp-content/plugins/surveys.php on line 56

    Warning: require(/home/vhosts/technical-world.freevar.com//wp-content/plugins/surveys/options.php) [function.require]: failed to open stream: No such file or directory in /home/vhosts/technical-world.freevar.com/wp-content/plugins/surveys.php on line 56

  10. can restrict the survey to users who has login to your web?

    another question: can you add following data to record, for the users, the answers he has selected?

    thanks very much

  11. how to modify this pluign to support other language asia language?

    this version can’t recognize chinese character

    this pluign is coding by utf8?

  12. Hi, I installed it, activated it, got an error, deactivated it, reactivated it (no error) but I can’t see “Manage > Surveys” anywhere? I’m using 2.8 and I’m new to WordPress. Am I missing something? Thanks!

  13. I am unable to add a new survey. I get a message You do not have sufficient permissions to access this page. However, I am the administrator.

  14. Hi Binny, I’m getting the same error as Tom above – “You do not have sufficient permissions to access this page.” This happens once I click on the “Create New Survey” link on the “Manage Survey” page. I trying this on a local installation of WordPress on Windows & Apache.

  15. Hi

    Does anyone know why I cannot see any surveys I create when I return to Manage Surveys? It tells me there are no surveys found and just gives me the option to create a new one.

    Using WP 2.8.3

    Thanks!

  16. I installed and get this error

    [Sat Aug 22 19:23:06 2009] [error] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘=’ at line 3 for query SELECT Q.ID,Q.question,(SELECT COUNT(*) FROM wp_surveys_answer WHERE question_id=Q.ID) AS answer_count\n\t\t\t\t\t\t\t\t\t\tFROM wp_surveys_question AS Q\n\t\t\t\t\t\t\t\t\t\tWHERE Q.survey_id= made by require_once, include

    If you find/fix, please email me and let me know.

    Thank you,
    Chad

  17. Hi binny,
    I’m using 2.8 and I’m new to WordPress.
    I’m getting the same error as Tom above and Nithin – “You do not have sufficient permissions to access this page.” This happens once I click on the “Create New Survey” link on the “Manage Survey” page. I trying this on a local installation of WordPress on Windows & Apache.

  18. Hi,

    I search and i see that in MYSQL logs :

    Erreur de la base de données WordPress Table ‘xxxxxxx.wp_surveys_survey’ doesn’t exist pour la requête SELECT S.ID,S.name,S.added_on,(SELECT COUNT(*) FROM wp_surveys_question WHERE survey_ID=S.ID) AS question_count,
    (SELECT COUNT(*) FROM wp_surveys_result WHERE survey_ID=S.ID) as response_count
    FROM `wp_surveys_survey` AS S faite par require_once, include

    I gives all permissions for my admin user on the database… I don’t really understand ..

  19. Hi,
    I resolve my first problem : the database was not created when a activate the plugin. I try to delete a reactivate plugin with the wordpress plugin administration and the database was not created. I decide to download the plugin then install it! and it works, the surveys database is created!!!!!!

    Now i have this problem when i want to create my first surveys with “create new survey” link :

    Error in database WordPress Table ‘xxxxxxx.wp_surveys_result_answer’ doesn’t exist for request UPDATE wp_surveys_result_answer RA SET question_ID=(SELECT question_ID FROM wp_surveys_answer WHERE ID=RA.answer_ID) made by activate_plugin, do_action, call_user_func_array, surveys_activate

    And i also have a page with “You do not have sufficient permissions to access this page.” However, I am the administrator and have all the permission in the database.

    I really don’t understand the problem ?? It seems to make a request upadte data in wp_surveys_result_answer table whereas i could not open plugin page to edit any survey!!

    Could you help me ?

    thanks,

    Denis

  20. Using WP 2.8 I can create surveys and embed them. When I go back to manage surveys there are no surveys showing.

    Any idea what the issue could be? Seems like at least one other person has the same issue.

    Thanks.

  21. How can I translate the survey plugin ?
    Where I have to put the .mo file ? And what name should I use for that .mo file ???

    Thank you

  22. I see the export to csv question came up a couple of times, any plans to address this in the future?

    FYI: I copied all the results and pasted them into an excel file. Excel was able to assign the data to all the individual cells pretty nicely, but I’m no excel expert. That’s as far as I went. I would imagine someone who knew excel fairly well could use that to generate whatever they needed.

  23. if you cant support why are you creating one plugin in a day! Create one and do it right and give good support. no language support, no answers on forum, no future wp version support.

    “You do not have sufficient permissions to access this page.” bah you too

  24. Hey guys, don’t be hard with him.
    Some of yours comments show me that you dont understand that even if a dev release a plugin, it doesnt mean that he has a full time to work on it.
    More of us have a job too and yes, we prefer to spend time to work for money and earn our food than work for
    free.
    I’ve made a lot of modifications to this plugin and i was going to releasr them but when i read the last comment by example, i dont want to.

    Now, you want a feature that isnt there? Ask gently and wait for it.
    You really need it? In a hurry? Pay for it. Im sure he will be please to work with you, or find a dev that has time (you have my website).

    Remember that we release plugin for a community an for
    free.

  25. Totally agree with Mat there; if you have issues with the plugin you either (a)try and fix it yourself (b) politely ask for assistance – remember it’s free assistance, so don’t behave as if you are entitled to it (c) stop using it and look for alternatives – nobody is forcing anyone to use this.

  26. @Mat, nithin
    Thanks for the support guys. I meant to update the plugins – but I’ve been so busy with my work and some other stuff that I did not find the time. But I will – someday soon.

  27. Plugin is working for me, but it’s not showing the radio buttons/check boxes on the home page. It only shows in the post. I did a little debugging and show_survey.php seems to be fine. Could WP be filtering this out somehow?

  28. I installed and created a survey fine, but after I put in [SURVEYS 1], publish, and view my live blog, the survey is not showing up. Can you please let me know why this is happening?

  29. Hi Binny,

    Thanks so much for creating this plugin. It’s awesome and seems designed to do what I need.

    Just one question: On some questions I have an “other” response and then activate the text input field is available for survey takers to specify what they mean by “other”. But it appears that they must click the radio button next to the text input field in order for me to see what they input. Is there anyway to have the text in the text input field automatically collected with the results or have it automatically collect if the “other” radio button is selected?

    Thanks much,
    Michelle

    • One more thing… the answer options are appearing out of order on my survey. For example the choices are 0-18, 18-32, 33-45. But instead it shows up to the user as 18-32, 0-18, 33-45. Any way around this problem? Thanks.

  30. Another bug, plugin not working with MySQL 5.1. You get this error when you try to add a question and no the question is not added to the database. Using WP 2.9 with MySQL 5.1


    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘=’ at line 3]


    SELECT Q.ID,Q.question,(SELECT COUNT(*) FROM wp_surveys_answer WHERE question_id=Q.ID) AS answer_count FROM wp_surveys_question AS Q WHERE Q.survey_id=

    </strong

  31. Hi Binny, I came across your plugins: eventr and surveys. I will install and use over the weekend. Just wanted to say thanks. Also, I wanted to invite you to be a guest tech writer from time to time on perhaps answering questions and/or suggestions that you may have on your mind.

    Harlem Talk Radio is the site and we launched it May of 2009. Please have a look and let me know what you think.

  32. Hello Binny. I try to “Add New Answer” – javascript:newAnswer() – in New Question but its not work. WordPress: 2.9.1. Plugin: 1.0.1.6. Thanks.

  33. Hello again Binny. I try “Add New Answer” in localhost (EasyPHP) and not work, but I install plugin in my site and its works fine. Great plugin.

  34. Binny,

    1. What types of question can I ask ? (I’m comparing your plugin with surveymonkey’s question types) I would very much prefer to use a plugin than survey monkey’s service so it would be good if you could do what they do ?

    2. What formats can you output – eg .XLS ?

    • 1. You can ask any kind of questions – you can even use HTML in your questions. I hope that is what you are looking for
      2. Plugin outputs CSV – it can be opened in Excel.

  35. Hey Binny,
    Thanks a lot, great plugin and very well written/commented code.

    One question – If on submit, I wanted to make sure the user has answered all questions (entered answers/hecked checkboxes), which file should I edit to add the validation? survey _action.php??

    Thanks a lot.

2 Trackbacks / Pingbacks

  1. Quartz WordPress Plugin | Bin-Blog
  2. Event Registration, Polls - Surveys, Paypal Integration, Migration from Joomla | WordPress Plugins

Leave a Reply to Nick Klyne Cancel reply

Your email address will not be published.


*