SurveyPress

August 7th, 2008

SurveyPress is a tool that helps you create your surveys for your WordPress Blog. You supply you own forms and it takes care of all the rest, such as collecting the data. Surveys cay easily be downloaded from your site into your favourite spreadsheet package.

Requirements

  • A basic knowledge of creating forms in HTML

Installing SurveyPress

  • download SurveyPress.
  • Copy to your ‘wp-content/plugins‘ directory.
  • Log in with an administration account.
  • Select the ‘Plugins‘ tab.
  • Scroll down to SurveyPress and click ‘activate‘.

Templates

To create a new template.

  • Create a directory inside the ‘pages‘ folder inside the plug-ins directory.
  • Name the folder to represent the template that you will use when inserting the survey into your post or page.

Inside the template directory you can create a number of files to modify the look of the form.

  • form.html
    • Purpose: this is the most important file of the all. This is the HTML form that will be used for the form. The only requirements for this file is that you omit the <form> tag and submit button as these will supplied by the plug-in.
  • alreadydonemessage.html
    • Purpose: This the message that will be displayed to the user if they have already filled in the form. This is optional, if it is not supplied a default one is used
  • thanksmessage.html
    • Purpose: This is the message that will be displayed when the form is submitted. This is optional, if it is not supplied a default one will be used.
  • closedmessage.html
    • Purpose: This is the message that will be display if this form is closed. This is optional, if it is not supplied a default one will be used.
  • rssfeedmessage.html
    • Purpose: There are problems filling out forms in RSS feeds so the form is disabled in the RSS feed. This is the message that will be displayed when the form is seen from an RSS feed. This is optional, if it is not supplied a default one will be used.

Anti-SPAM

The anti-SPAM is done by asking the user to name the nth colour in a random selection of coloured boxes. This does not require your site to have any graphics modules loaded.

Options

The Survey Data

As the surveys are completed, the data is attached as meta data to the post or page that the survey is on. This is done to integrate the survey data with the post or page, which allows you to backup or export your site without having to select any extra tables.

The Exported Data

The results are exported in the CSV file format, This can be easily imported into almost any spreadsheet or database. Along with the fields from you survey there a a number of other fields that are added to the file for information purposes. These are :

  • ip
    • Purpose: The ip address other the person who filled out the survey.
  • HTTP_REFERER
    • Purpose: The page that referred the user to the survey.
  • form_page
    • Purpose: The tittle of the post or page the survey is on.
  • form_page_url
    • Purpose: The address of the post or page the survey is on.

Version History

  • 1.0.0
    • Initial internal release.
  • 1.1.0
    • Corrected problems with radio buttons on forms
    • Added once attribute
    • Added time-out attribute
    • Added antispam
  • 1.2.0
    • Added action for use with templates
  • 1.3.0
    • Updated Libraries
  • 1.4.0
    • Improved form loading. Added configure screen, added direct download.

Other Plug-ins

If you liked this plug-in visits our download area where you will find many more.

Bugs & Suggestions

If you have questions, have found any bugs, or you would like to see features added to SurveyPress please feel free to use the form at the bottom of the page to Contact us. If SurveyPress doesn’t fill your needs , feel free to Contact us to discuss a specially commissioned plug-in.

Show Your Appreciation

If you liked SurveyPress please:

You can also make a donation to Help support its development.


  1. August 14th, 2008 at 22:09 | #1

    What would be the best way to require certain form fields to be submitted? I found some javascript that I could use, but it requires me to add an onsubmit event to the FORM tag. How would I go about that?

  2. August 15th, 2008 at 10:24 | #2

    @Josh-
    This is something that is planned, when we figure out a nice way that will work for most users.
    Until then the easiest way for you to do it is with the script file you have. To add this copy the file ‘classes/surveypress/templates/default/mainform.html.php’ into you template directory. This contains the FORM tag, so you can add your onsubmit here.
    One thing to note, this file is one of the templates files that shouldn’t really be changed or overridden, well without knowing what your doing. Changes are planed for this file. so just keep an eye on this when you upgrade the plugin. It should be just a matter of copying accross the new mainform.html.php if any changes are made in the new vesrion.

  3. August 15th, 2008 at 16:46 | #3

    Thanks! I’ll do that and report my results!

  4. August 15th, 2008 at 17:11 | #4

    That worked! Thanks a ton!

    FYI, the script I used is here:

    http://www.dynamicdrive.com/dynamicindex16/requiredcheck.htm

  5. Neil
    September 2nd, 2008 at 10:09 | #5

    Hi, I can’t seem to get rid of the bit space that is between the page title and the actual form, I have put everything to zero and still gives me a large gap.

    Cheers

  6. September 2nd, 2008 at 10:40 | #6

    @Neil:
    This may be due to css on the containers the survey is held in.
    If you post a link to the page, I’ll see if I can advise how to fix this.

  7. Neil
    September 2nd, 2008 at 10:56 | #7

    Hi, I can’t give you the link because i’m running it on an intranet.

  8. September 2nd, 2008 at 11:04 | #8

    @Heil:
    Ok,
    if you take a look at the source html, and adjust the css to reduce the padding and margins for the elemets of the survey.

  9. Neil
    September 2nd, 2008 at 11:06 | #9

    Hi,

    Which one is the source? The one in \pages\example?

    This is the one I put zero margin’s in for everything.

    Thanks

  10. September 2nd, 2008 at 11:12 | #10

    @Neil- I was meaning the source that you see in the bowser. Depending the theme, things like this can happen, makesure that all the elements in the form fit into the width the theme sets, also remember the padding, this can cause things to overflow.

  11. Neil
    September 2nd, 2008 at 11:17 | #11

    Hi,

    Ok will have a go, thanks!

  12. Shareta
    September 4th, 2008 at 19:46 | #12

    Hi! When I go to download the results from the dashboard, I get a blank php file (surveypress.php).

    I also searched the db and results directory on my server and I don’t see any data.

    Survey link: http://www.fatstylist.com/sabby-anand/everybody-counts/

    Thanks

  13. September 4th, 2008 at 21:01 | #13

    @Shareta: Sorry to here of your problems. Just double checked on the plguin on the test system and it does work as expected.
    So there must be some incompatibility with your setup.
    For your info, the data is stored in the postmeta table with the key “survey_data”, one entry per result. This is probable not much use unless you are a programmer.
    The results directory was superseded with this new method in the last release to get round problems with file access.
    What should happend when you click the download, is the surveypress.php you offer up the standard download box to download the csv file of your data.
    At present there are two possible causes.
    it could be caused by a popup blocker. If you could disable this if you have one and try it.
    OR it could be something different with you installation. in which case could you inform us of:
    your version of PHP
    your version of wordpress
    your OS

    If you require the data quickly, installing an older version that exports the data to the results directory. This will solve the problem.
    A permanent solution to the problem is now being looked into.

  14. Shareta
    September 4th, 2008 at 23:04 | #14

    DCoda-

    My pop up blocker is off and I tried downloading again and still got a blank php file.

    I’m running PHP 5, WP version 2.6.1, Mac OS 10.4.11.

    Thanks!

  15. Shareta
    September 4th, 2008 at 23:31 | #15

    DCoda-

    I just downloaded the table for survey_data and I see there is data being written to the db. I can see all my test answers.

  16. Shareta
    September 5th, 2008 at 00:01 | #16

    Problem averted, DCoda. I downloaded an older version (1.1.0) and this works.

    I wonder why the new version doesn’t work for me? That’s ok for now. Thanks for all your help!

  17. September 5th, 2008 at 12:00 | #17

    Shareta:
    When you say you are running mac OS is this on the server or you local machine. It is the server OS thatis of interest.

    For the new version to work, it has to know where it is being run from. Different OS’s and versions of php sometime deal with this infoin different ways.

  18. Joe
    September 16th, 2008 at 20:17 | #18

    Hi- this plugin looks great, but I’m having trouble geting the results. I’m getting ‘An unidentified error has occurred.’ when I try to add the survey_data custom field and if I don’t add it I can click the ‘download’ button, but it just redirects to a black page. Any help would be appreciated!
    Thanks

  19. September 17th, 2008 at 09:11 | #19

    @Joe:
    It would appear the direct download that was introduced in the last version, has some problems n some system.
    if you revert back to version 1.3.0 which you can find here
    http://wordpress.org/extend/plugins/wp-survey/download/
    you will be able to download your results.
    you will need to create a results directory in the plugin folder that is writeable.

  20. primatepress
    September 24th, 2008 at 16:06 | #20

    I have installed SurveyPress and gotten the survey to work but there is no anti-spam. Since it says only non-admin users will see this, I’ve checked it from several remote unknown computers. But there is no anti-spam of any kind, no choosing of the “nth color.” What’s wrong?

  21. primatepress
    September 24th, 2008 at 19:42 | #21

    Hi DCoda

    I am making a webpage with a SurveyPress survey on it and someone will be downloading the CSV file onto a PC. Is there any way they can get a virus from this? I use a Mac, so I don’t worry about it on my end. Will I have to worry about spam going into the survey? Thanks — I wrote a post earlier about the anti-spam, which I don’t see.

  22. September 26th, 2008 at 10:28 | #22

    @primatepress:
    there does appear to be a problem with the defaults, preventing the antispam from showing. This will be addressed in the next version.

  23. September 26th, 2008 at 10:30 | #23

    @primatepress:
    Since a cvs is basically a text file, I don’t see any problem with viruses.
    Most surveys don’t use the antispam, but a fix for the problem is being looked into.

  24. September 28th, 2008 at 12:29 | #24

    I am having difficulties exporting data using the plugin. Everytime I download the csv file it contains only “0″”" which displays as a single 0 in Excel. Looking at the database, I can see that the data is being written properly, so I assume it just isn’t being exported right. I am running 1.4.

    Thanks in advance.

  25. September 28th, 2008 at 12:44 | #25

    @Jared Smith:
    It does appear that the direct download method introduced in version 1.4 has problems on some systems. If you need to download your results in a hurry the easiest way is to install version 1.2. This will out put the results to a results directory and provide you with a link to retrieve them.
    The direct download method has been removed from the next release until the problem can correctly be diagnosed. This should hopefully be released soon.

  26. September 28th, 2008 at 14:55 | #26

    Thanks for your help. I will wait for the update. Also, is it possible to configure the plugin to email the survey responses or email a notification that the survey has been completed?

  27. September 28th, 2008 at 16:02 | #27

    @Jared Smith:
    Yes it it is possible. But is at present an undocumented feature that wasn’t included until it could be full integrated into the documentation.
    if you add the attribute
    emailme = “yes”
    this will sent an email to the post author containing the response to the survey.
    I hope this is helps.

  28. primatepress
    September 30th, 2008 at 19:17 | #28

    A wonderful plugin! Thanks for your responses.

  29. primatepress
    October 2nd, 2008 at 02:57 | #29

    Hi DCoda,

    Some feedback re. Neil above, on Sept. 2. I get this same effect - no matter what I do to the CSS or which theme I use, there is an equal chunk of space above and below the form. It doesn’t matter what content comprises the form, either, because on this page I entered only two words, “test words”, and no fields at all:
    http://www.waschmidtgraphics.com/holttest/?p=38
    I’ve tried deleting all margin and padding values in the CSS. Just thought it might help you to see this problem in action. Any thoughts?

  30. PrimatePress
    October 2nd, 2008 at 04:39 | #30

    Answer to my own question: these gaps are caused at the bottom by the invisible submit fields. In the SurveyPress CSS file I changed their font size and line height to 1px and this greatly reduces the space.

    At the top the gap is caused by all the fieldsets that aren’t being used in my form, username, email, etc. When I deleted all the fieldsets from the mainform.html.php file except the copy fieldset, the gap at the top got smaller, but is still there. If you visit the link above it will no longer display the large equal gaps I reported earlier.

  31. Mike
    October 12th, 2008 at 22:26 | #31

    Hey, Im putting together a survey for a game me myself and a few friends are running, your plugin is great, I got one problem tho, it adds after each line so on my one survey I get 219 validation errors and viewing it with for example chrome the makes each radio options appear below eachother instead of lined on the same line (the options are 1-5)

    here is my dev site for my wordpress:

    http://www.beernweed.net/wordtest/?page_id=74

  32. October 13th, 2008 at 09:17 | #32

    @Mike- I’m not sure what the problems is. The site looks fine for us in firefox and chrome. There are only a few html validations errors on the page when checked, only a few warnings are caused by the html generated by the plugin.
    These warning are minor, but will be looked into in the next version.

  33. Mike
    October 13th, 2008 at 10:18 | #33

    Problem solved I removed add_filter(’the_content’, ‘wpautop’); from /wp-includes/default-filters.php

    noticed aswell that it didnt show the br I posted in previous post.

  34. Mike
    October 13th, 2008 at 10:19 | #34

    ah I didnt refresh the page before I wrote that last one, yeah I solved it a few hours ago removing the part I mentioned, one of the features I really dont like with wordpress with it adding p and br everywhere:P

    Cheers, keep up the great work

  35. October 28th, 2008 at 01:32 | #35

    I used the plug in, which worked great, but now am unable to pull the collected info down. I attempted to install V. 1.2.0, but was still unsuccessful.

    could you point me to a reference for a non-direct download of results?

    Thanks

  36. Patrick
    October 30th, 2008 at 14:39 | #36

    Could some post a working example. Im using Version 1.4.0, and get in the downloadable file:
    Warning: unserialize() expects parameter 1 to be string, array given in /var/www/coolit/wp-content/plugins/wp-survey/library/classes/base.php(148) : eval()’d code on line 60

    Warning: unserialize() expects parameter 1 to be string, array given in /var/www/coolit/wp-content/plugins/wp-survey/library/classes/base.php(148) : eval()’d code on line 60

    Warning: unserialize() expects parameter 1 to be string, array given in /var/www/coolit/wp-content/plugins/wp-survey/library/classes/base.php(148) : eval()’d code on line 60

    Warning: unserialize() expects parameter 1 to be string, array given in /var/www/coolit/wp-content/plugins/wp-survey/library/classes/base.php(148) : eval()’d code on line 60
    “0″
    “”
    “”
    “”
    “”

  37. October 30th, 2008 at 14:52 | #37

    @patrick:
    Not entirely sure what could be causing you problems.
    Two thinks come to mind.
    Have you modified the fields the survey after the survey has gone live, This will cause problems.
    Also there are problems with the download method in version 1.4.0 on some system, it is recommended that you revert to version 1.1.

  38. October 30th, 2008 at 14:54 | #38

    @John Knox White : I thik f you try version 1.1.0 this will download the results. This was the last version version not to try the direct download which seems to be causing problems

  39. November 3rd, 2008 at 00:42 | #39

    Hello DCoda,
    I have the same error like Patrick
    “Warning: unserialize() expects parameter 1 to be string, array given in /var/www/coolit/wp-content/plugins/wp-survey/library/classes/base.php(148) : eval()’d code on line 60″
    in CSV file.
    I tried version 1.1, but I had error line 25.
    My survey is here http://www.eu-russiacentre.org/survey
    It is only radio buttons.

  40. November 5th, 2008 at 00:29 | #40

    Hi!
    Is it possible that you provide me a sample complete quiz so i can replace it with the info that i want?

    Thank you!

  41. November 5th, 2008 at 10:04 | #41

    @JC,
    from the error it sounds like there either is no survey data, or that questions were added to the survey after it had already been filled in.

  42. November 5th, 2008 at 10:04 | #42

    @ownerpredator,
    There is an example template.

  43. November 5th, 2008 at 18:58 | #43

    I reinstalled plugin and made new survey. And the same in file CSV - Warning…line 60

    Can I use in form.html some html tags except [p][/p]? Tables, span, div?

    Do you have example of survey with radio and chechkboxes, may be I did some errors in my code?

    Can you look exactly in my form, please?
    http://eu-russiacentre.org/wp-content/plugins/wp-survey.1.4.0/pages/second/form.html

  44. November 5th, 2008 at 18:59 | #44

    Another question - how can I reset data of survey?

  45. November 5th, 2008 at 19:19 | #45

    @JC.
    you can use any html you like in the form.html, that was the main objective of the plugin, all you need to is supply the “name” variable for each form field.
    Sorry I don’t have any examples with radios buttons.

    The survey data is attached to the post,the simplest way to reset this is to copy the post content to a new post and delete the old post.

    Work permitting, there should be a new version out soon, that should address a few problems.

  46. kopytko
    November 24th, 2008 at 12:51 | #46

    Idea is great, but survey doesn’t work. I can make survay, place it on my blog, by i can’t get the results.

    Warning: unserialize() expects parameter 1 to be string, array given in C:\wamp\www\blog\wp-content\plugins\wp-survey\library\classes\base.php(148) : eval()’d code on line 60
    “0″
    “”

    I’m working on Windows on localhost.
    Its happening on every survey, even new one.

  47. November 24th, 2008 at 14:28 | #47

    Sorry to here of you problems.
    There are some problems with theme download method on the current version on some configurations.
    If you revert to version 1.1 you should be able to download your results.
    The problem will be addressed in the next release.

  48. kopytko
    November 24th, 2008 at 16:11 | #48

    Thanks for answer. I’ve tried version 1.1 before, but with the same result. But i have managed to run your plugin just few minutes ago. I was using WP 2.6.3. Now i’m using 2.6 and there is no problem with downloading reports.
    I’m looking forward for next release.

  49. February 20th, 2009 at 13:35 | #49

    Hi DCoda, thanks for the plugin, we are using it for collecting feedback for internal developers trainings.

    Wierd enough, I cannot see/edit filled in survey data for my post as custom field. I can easily download them though, using URL http:/…/wordpress/wp-content/plugins/wp-survey/surveypress.php?results=375

    I would like to edit already commited answers, so I searched the custom fields for my surveyed post, but the only custom fields there is ratings_average, ratings_score, ratings_users. I can see survey_data item in “Add a new custom field:” select box though.

    So my question is, have you any idea why I cant see survey_data with filled in values as custom field?

Comment pages
  1. July 9th, 2008 at 08:41 | #1