Home > News > Here’s a quick way to run a petition in WordPress

Here’s a quick way to run a petition in WordPress

October 3rd, 2007

I’ve written a short and simple plugin that embeds a web based petition into your WordPress page or post. Signatures are confirmed by e-mail and the administrative interface allows for customization along with deletion and exporting of signatures. Learn more now.

James Davis News

  1. November 30th, 2007 at 05:14 | #1

    Great software! Simple and easy to install. Thanks! Two questions:

    How can I format my text in the petition? Bold, underline, paragraphs, indent?

    In the export file I do not get written comments? They are extremely important. How can I retrieve them.

    Thanks again…great that you contribute this to everyone! Bravo!

    b

  2. December 3rd, 2007 at 22:49 | #2

    I tried installing it, and initially ran into some difficulties. I received a sql error saying comment was too large, (300). I changed fcpetition.php where the sql lines are from 300 to 255 and everything worked great! Might want to make the change to the textarea so nothing gets cut off. Thanks for the plugin.

    P.S. I used it here http://blog.johnebradle.com/petition

  3. Steve
    December 25th, 2007 at 04:09 | #3

    Hi!

    I’m sorry if this is a newbie thing but I’m getting this error and I don’t know what to do about it. I’m just setting up wordpress for the first time because I want to use your petition.

    Any help is appreciated.

    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 '), time DATETIME, UNIQUE KEY email (email) )' at line 5]
    CREATE TABLE wp_petition ( email VARCHAR(100), name VARCHAR(100), confirm VARCHAR(100), comment VARCHAR(), time DATETIME, UNIQUE KEY email (email) )

  4. January 2nd, 2008 at 20:44 | #4

    Same problem of steve.

    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 '), time DATETIME, UNIQUE KEY email (email) )' at line 5]
    CREATE TABLE wp_petition ( email VARCHAR(100), name VARCHAR(100), confirm VARCHAR(100), comment VARCHAR(), time DATETIME, UNIQUE KEY email (email) )

    NO ANSWER?

  5. January 3rd, 2008 at 19:12 | #5

    Problem solved.
    Thanks to James.

    Just replace that you can find at
    http://svn.wp-plugins.org/wordpress-petition-plugin/trunk/fcpetition.php
    Bye

  6. Matthew Miller
    January 22nd, 2008 at 00:58 | #6

    Hi

    Trying to use Petition plug-in. The confirmation email is not showing the name of the petition or the confirmation email.

    What could I be doing wrong?

    I have inserted the placeholder [[petition-1]] into my page. Is this the right way to do it?

    Cheers
    Matthew

  7. James Davis
    January 22nd, 2008 at 10:44 | #7

    Matthew, sorry about this. It appears that due to issues beyond my control, my development code is being distributed as the stable version by wp-plugins.org.

    The stable version is available at http://svn.wp-plugins.org/wordpress-petition-plugin/tags/1.0.1/

  8. January 24th, 2008 at 11:46 | #8

    I just wanted to drop this note to thanks James for all his help!

    Much appreciated James.

    Regards
    Leigh

  9. Pete
    January 30th, 2008 at 13:35 | #9

    Hi James,

    Thanks for the work on the plugin – it looks like just what I’m after but I’m having a bit of trouble getting the plugin to work.

    I am developing a WordPress 2.3.1 blog on a Windows server :( with IIS, MySQL & PHP.

    I have modified my ABSPATH definition in the config file to cope with the Windows server.

    When I add the latest files within the plugins folder and within a folder called wordpress-petition-plugin, activation in the admin is fine, but when I go to Options > Petition, check Enable Petition, I get the following error message:

    Fatal error: Cannot redeclare fcpetition_upgrade() (previously declared in D:\Websites\HolidayTravelWatch\Website\wp-content\plugins\wordpress-petition-plugin\fcpetition.php:38) in D:\Websites\HolidayTravelWatch\Website\wp-content\plugins\wordpress-petition-plugin\fcpetition.php on line 49

    I guess that tells me that that the page is running twice but I cannot find out why? I don’t suppose you have any ideas?

    Thanks in advance,

    Pete

  10. February 2nd, 2008 at 18:54 | #10

    This is a great little plugin, and freecharity is a great initiative too! You should get in touch with the good folks at MySociety.org (the people behind sites like PledgeBank.com) for ideas and tools that could come in handy for cash-strapped UK charities.

    Best wishes,
    Eoin

  11. David
    March 5th, 2008 at 00:52 | #11

    WordPress 2.3.3, Keep getting “Sorry, someone has already attempted to sign the petition using this e-mail address” even though there are no successful petition submissions yet.

    Using the petition page as the home page – is that effecting this? I’ve tried multiple permutations of URLs, to no avail.

    (Incidentally, even though the readme file says version 1.0.1, WP plugin page insists it is 1.0 and prompts to download the new one again.)

  12. April 17th, 2008 at 19:43 | #12

    Hi if others are interested in language variants may be we can help

  13. jason
    April 18th, 2008 at 23:46 | #13

    Hi, whenever anybody types the following: ‘
    it shows up as a: \
    not sure why.

    so ‘hello dolly’ shows up as \hello dolly\ for some reason. any help would be much appreciated.

    jason

  14. jason
    April 18th, 2008 at 23:47 | #14

    also the ability to edit the comments made on the petition would be great, i.e. to take out swear words etc.

  15. April 20th, 2008 at 00:04 | #15

    I’m getting an error

    mysqldb.wp_petition_signatures’ doesn’t exist]
    select petition_confirmation,petition_from,petition_title,confirm from wp_petition_signatures,wp_petitions where wp_petitions.petition = wp_petition_signatures.petition and email = ‘spacemanmkd@gmail.com’ and wp_petitions.petition = ’2′;

  16. April 20th, 2008 at 00:19 | #16

    it works with the new file.

    thanks. great scrript.

  17. evowebber
    April 22nd, 2008 at 20:06 | #17

    im having similar problems to jason, not showing the characters correclty shows ‘/////’ instead of quotes.

    also when results are exported to csv, can the results be ordered into columns for excel, i.e. one column for emails relieved, one for names, it all seems to throw it all in together in one big line of info. Which means you have to manually sort through the results to arrange i.e. all the emails addresses together etc. I want to just be able to see a column of emails and names in excel but it doesnt arrange it like this when I click export to csv.

    thanks, brilliant script.

    TG

  18. May 25th, 2008 at 07:25 | #18

    I’m getting an error

    mysqldb.wp_petition_signatures’ doesn’t exist]
    select petition_confirmation,petition_from,petition_title,confirm from wp_petition_signatures,wp_petitions where wp_petitions.petition = wp_petition_signatures.petition and email = ’spacemanmkd@gmail.com’ and wp_petitions.petition = ‘2′;

    ?

  19. June 7th, 2008 at 01:26 | #19

    im having similar problems to jason, not showing the characters correclty shows

  20. June 9th, 2008 at 13:27 | #20

    Nicely implemented plugin. It works great – thankyou.

    I do have a suggestion, add a postal code entry or perhaps a city and state/province field.

  21. June 12th, 2008 at 13:35 | #21

    The database error probably indicates that you’re running an older version of the plugin. Please download the latest version and let me know if you still have the same problem.

    As for post code/city/state/province fields, this is something I’ve been thinking of adding but I’m waiting until I can come up with a solution to fit all locacles before releasing any changes.

  22. June 26th, 2008 at 14:14 | #22

    Great plugin! Clear code.

    One thing: There should be created an index in petition_signatures table on filed time, there is a lot of sorting on it.

  23. Oscar Hayward
    July 20th, 2008 at 17:16 | #23

    I ran into some problems during installation, namely the signatures weren’t being registered at all. Basically what Dave ran into.

    The reason was that in the SQL syntax, ‘confirm’ and ‘fields’ are MySQL keywords, and weren’t being treated as strings. Therefore the solution was to wrap them with quotes (`). Now it works like a charm!

    James, I suggest you implement this into the next release, as it could affect quite a few users.

    Many thanks for the plugin!

  24. James Davis
    July 20th, 2008 at 17:27 | #24

    Dave’s problem was fixed some time ago, you shouldn’t be seeing the same one. What version of the plugin have you downloaded?

  25. Maak
    July 31st, 2008 at 11:04 | #25

    Can someone post a link to a site that uses this plug-in, or to a demo site?

  26. August 2nd, 2008 at 19:24 | #26

    Version 2.1 on wp-2.5.1 Plugin appeasr to be working correctly, except for a warning invalid argument in the management page. see as follows:

    Warning: Invalid argument supplied for foreach() in /home/removed/public_html/demos/test1/wp-content/plugins/wordpress-petition-plugin/fcpetition.php on line 885

    In addition, it’s not clear how to add custom fields and it appears that this error maybe connected.

    Thanks for your help.

  27. August 18th, 2008 at 17:15 | #27

    Nicely implemented plugin. It works great – thankyou.

    I do have a suggestion, add a postal code entry or perhaps a city and state/province field.

  28. August 27th, 2008 at 08:35 | #28

    This page:
    http://www.freecharity.org.uk/wordpress-petition-plugin/

    says “The latest version of the plugin now allows you to add custom fields to your petition.”

    Well, I can’t find any instructions telling how this is done.

    Please advise.

    Thanks,

    Joe Testing

  29. James Davis
    August 28th, 2008 at 16:29 | #29

    It’s not very clearly indicated but it’s at the top of the petition options page. The latest release of the plugin has fixed this lack of clarity.

  30. Louise
    October 6th, 2008 at 13:53 | #30

    I love the plug-in! Thank you for the hard work.

    I have an unusual problem – the confirmation email that goes out to the person signing the petition never gets to AOL or Bellsouth email addresses. Is there anything simple I can do? I have run into this before and had to use smtp through a google apps gmail set up, but was hoping to avoid that this time.

    Anyone else run into this?

  31. October 31st, 2008 at 19:22 | #31

    Hi, whenever anybody types the following: ‘
    it shows up as a: \
    not sure why.

  32. November 6th, 2008 at 19:33 | #32

    Just installed version 2.2.1 and I’m getting this error:

    Call to undefined method wpdb::has_cap() in /customers/leverpark.co.uk/leverpark.co.uk/httpd.www/wp-content/plugins/wordpress-petition-plugin/fcpetition.php on line 175

    Any ideas?

  33. such sweet thunder
    November 9th, 2008 at 22:05 | #33

    Hi, this looks like a great pulgin, but for whatever reason, it isn’t sending the confirmation email. Is anyone having a similar issue?

  34. December 28th, 2008 at 11:35 | #34

    Error :
    mysqldb.wp_petition_signatures’ doesn’t exist]
    select petition_confirmation,petition_from,petition_title,confirm from wp_petition_signatures,wp_petitions where wp_petitions.petition = wp_petition_signatures.petition and email = ’spacemanmkd@gmail.com’ and wp_petitions.petition = ‘2′;

    ?

    Please help me…

  35. January 3rd, 2009 at 20:01 | #35

    Is there a way to put the petition form on the sidebar?

  36. January 14th, 2009 at 22:26 | #36

    Hello, I would like to use this plugin for my website. Would like to publish a “petition blog”.

    One thing is missing in your script. I really need a numeration for the petition. And why is there no function to list all petition entries?

    I can only list the last xxx entries but not all. This new function should contain pagination. Would be crazy to list 500 entries on one page.
    If you might could add those function, I would use it for my next project.

  37. Michael
    January 22nd, 2009 at 04:16 | #37

    LIMIT THE COMMENT SIZE: Instructions found in the code say “Define the maximum comment size. You can’t simply just change this for an existing install, you must modify the database table too.” Question: How do I “modify the database table”?? What part to I change?

  38. James Davis
    January 23rd, 2009 at 13:25 | #38

    Ignore that comment in the code, you shouldn’t need to change the database tables to alter this line any more. The database can store comments of any size, although the code limits them so that they can be easily displayed.

  39. February 4th, 2009 at 12:34 | #39

    Helloo and Thank U for the great plugin .

    Is there a way to stylize the boxes where the user inputs his name/email/website?
    I have placed the petition on a white page, the boxes never appear ! I had to randomly click on the white space under the “name” etc till I detetcted the input fields when I say the blinking writing pointer.

    http://www.al-rasid.com/blog/what-is-my-blog-about/petition-to-hp/

    Also, the boxes came aligned to the right. Is there a way I can align them to the left ?

    Another thing I wish you to consider. When I was setting my first petition, I added the information and came to the “custom fields”. I added a field and hit “Add” and it added it, and automatically refreshed the page where all the texts I added above in the petition text were deleted because I didnt yet save the changes, and I had to fill them in once again, but this time saving, then adding a custom field.

    So, the option to add a custom field should load inline not refreshing the page, or that it should be shown only after all the fields have been created..

  40. February 16th, 2009 at 17:54 | #40

    When trying to use this plugin, some people were able to sign it a few weeks ago, but now people just get this error when clicking the confirmation link:

    “The confirmation code you supplied was invalid. Either it was incorrect or it has already been used. ”

    Any ideas?

  41. James Davis
    February 20th, 2009 at 12:18 | #41

    @Mouad
    The problems sound as if they’re related to your theme – the plugin doesn’t really do anything fancy in it’s output other than wrap some parts in div’s so you can style them with CSS. You can alter the output by editing the plugin – there isn’t an easier way at the moment.

    As for the second problem. I know about that one :-)

  42. James Davis
    February 20th, 2009 at 12:18 | #42

    @Ryan Thompson
    That’s an odd one. Are you able to look directly at your MySQL tables?

  43. February 23rd, 2009 at 20:30 | #43

    Thanx James, but I think the problem lies in that my theme’s BG color is white, and the text fields of the petition are white too (I suppose), that is why the fields’ borders do not appear (Please consider looking here : http://www.al-rasid.com/blog/what-is-my-blog-about/petition-to-hp/).

    As regarding stylyzing the css and change the direction/align of the text, as well as other things, I dont know where to do that. I never found .css file to customize .. and I am not qutie an expert in PHP :(

    I basically want fix the view, it is corrupted as you can see in the link above.

    Another thing, how exactl can I convert the plugin into other languageo f the langs packed with it ?

    Thanx very much

  44. February 26th, 2009 at 13:00 | #44

    @Mouad
    I’m fairly sure that the white background of your fields, is due to your theme. I imagine that it may be placing borders around fields in particular sections of the page, but not in the post content (perhaps the author didn’t expect to find them here?). I’m afraid I can’t help you with this, try contacting the theme’s author.

    There’s a program called poedit which you can download from http://www.poedit.net/. Use it to load the .pot file included with the plugin and it will allow you to create po and mo files for your language.

  45. February 26th, 2009 at 14:23 | #45

    Hey James and thanx for replying.

    I wish you answer my question on how to stylize the plugin with CSS .. as I said before, I found no css file to modify, nor found I css properties inside the plugin’s php files. If I find it, I might stylize the text fields to have a different color than white (light yellow for instance), but I coudnt find the css properties to edit !

    For the language thing, I understood that I can create new files, but how can I apply those new po and mo files to be actually active in the plugin instead of English ?

    I am really needing your quick response.. Thanx !

  46. February 26th, 2009 at 14:48 | #46

    @Mouad
    That is because there is no CSS, the plugin leaves this to your theme. You need to alter your theme so that it shows the form correctly. I cannot help you with this.

    Once you have generated a .po/.mo file, place them in the same directory as the plugin. Alter your wp-config.php to set the language. For example define (‘WPLANG’, ‘nb_NO’); to use fcpetition-nb_NO.m.

  47. February 26th, 2009 at 15:46 | #47

    @Mouad

    But regarding the style.. is there no way at least to align the plugin to the left, with the theme still aligned to the right ?

    The alignment of fields in the petition’s form is decided upon by the theme you are using (if you switch to the default theme, you should find that the fields are aligned centrally).

  48. February 27th, 2009 at 19:47 | #48

    Great plugin!
    There is a JS-injection security problem, though. Try input >’>alert(123)<’ for the name or any custom field and you will see then the jscript will execute on both the post page and in the admin panel. This can be used by malicious users to redirect all visitors to other sites, for example.

    The fix is pretty simple – use htmlspecialchars(field,ENT_QUOTES) when displaying html.

  49. Vivek
    March 14th, 2009 at 17:05 | #49

    Hi,

    I am using your petition plugin on my website. I wanted to use the petition on a facebook app and on a standalone website. I want to use the e-mail verification option on the website, but not on the app. How can I do that?

  50. James Davis
    March 16th, 2009 at 12:52 | #50

    I’m afraid that I don’t know anything about programming facebook applications.

Comment pages
  1. No trackbacks yet.