Support » Plugins and Hacks » [NEW PLUGIN] Democracy AJAX Poll

  • I’m announcing my second ever WordPress plugin, Democracy. Democracy adds polling functionality to your WordPress blog. It grew out of frustration with the only other WordPress polling option, WP-poll. It didn’t have valid markup, it was clunky, and it required one heck of an installation process. So I decided to create my own, using WP-poll as a reference. This plugin uses AJAX for quick sending and loading of poll data, although it doesn’t depend on javascript to function, like my other plugin. It is fully functional in non-javascript environments, meaning it will work in ALL browsers. The AJAX part is tested to work in Safari, Opera, Firefox, and IE6/Win. The poll is in my sidebar, so go ahead and see for yourself.

    For more information and the download: http://blog.jalenack.com/archives/democracy/

    It also has a full-featured admin panel, which allows one to manage their polls. You can activate, edit, delete, and add new polls from the admin panel. It is also harder to ballot-stuff than WP-poll. It uses cookies as well as IP logging to prevent users from working spamming the ballot box.

    And Installation is a piece of cake. Just upload it to your server, activate it, and place a template tag in your theme where you want the poll to appear.

    Note, this version is Alpha. However, it’s been thoroughly tested by around 10 people without problems, so it’s nothing like my shoutbox plugin that was so terrible in the early days. Please report any errors you encounter with it in the comments below. If you like it, saying thank you is all I ask.

Viewing 15 replies - 1 through 15 (of 89 total)
  • If this is as good as WordSpew, I want it…unfortunately…

    The page you tried to navigate to does not exist. This could be because you typed in the wrong URL, you were given a bad link, or there was a server error. If you don’t believe it was your problem, please contact the blog owner and alert them of this dead link. Ready to go back to the home page?

    Sorry, I’ve edited the link. Here it is again:

    http://blog.jalenack.com/archives/democracy/

    two words: badass.

    i can’t spell,
    mat

    I started to use Democracy and it seems to work ok
    http://www.turkku.com/blogi/

    However, I’d like to make cookie (and perhaps IP checking too?) to expire after 1 hour (polls on site are never serious but for fun).

    How do I do it? On ‘Manage’ panel you can’t do nothing. What is that file requiring manual changes?

    Hey,

    That’s kind of an odd request. But alright, it should be simple enough. You’ll need to edit the democracy.php file. All of the action is at the bottom, whereas the functions are at the top.

    1. In the checkIP function (around the middle of the file [line 315 or so]) .. comment out the line that says
    die("Go stuff the ballot box elsewhere");

    2. At the bottom, edit the setcookie() information to only take one hour. Around line 489, change the time from time()+60*60*24*30*3 to time()+60*60

    3. Edit js.php, and look for document.cookie … There should be some php around there. Again, change time to time()+60*60

    Good luck.

    On another note, I hope to release a new version of the poll in the near future.

    n/m. Stupid tags.

    Almost perfect…

    One thing, I am looking for the option to have some Polls allow for user submited answers? Is this possible in a future version?

    Sure, I could probably do that. As an option, of course. Not all people would want their users to be able to add answers.

    # That’s kind of an odd request.

    Well… basically, yes. If you have a site with a million voters per day, serious poll and a valuable prizes. But if there are only less than 100 visitors and poll is just for fun (with no prizes at all), then you perhaps like them to come back OFTEN and vote MORE! 😉

    I made changes like you suggested. It’s like this now.

    1. if (in_array($_SERVER['REMOTE_ADDR'], $results)) {
    // die("Go stuff the ballot box elsewhere!");
    }

    2. //set cookie for 3 months (now 1 hour!)
    setcookie("demVoted_" [...] aid,time()+60*60,'/');
    jal_checkIP();

    3. $offset = 60*60;

    Unfortunately cookie now seems not to work at all. You may try it here
    http://www.turkku.com/blogi/

    After voting the “Vote” button (in Finnish) won’t fade from the results page and it’s possible to go back and vote again. 🙁

    Any suggestions?

    Hmm, when I vote, it works fine. I don’t see the vote button again. And FYI, changing the $offset won’t help. It is this line (126) of js.php that you need to change:

    ....expires=<?php echo gmdate("D, d M Y H:i:s",time() + 60*60)." UTC"; ?>;path=/;";

    Changing the $offset will just make the file cache more often, which is generally bad.

    Just updated to Alpha3, added a lot of new features:

    http://blog.jalenack.com/archives/democracy/

    # Hmm, when I vote, it works fine. I don’t see the vote button again.

    This was weird — until I noticed that there were no troubles with Firefox (my default browser). As I “never” use IE myself and I had disabled everything possible there it didn’t work. Restoring default (cookie etc.) settings fixed the problem.

    So the code is fine and so am I and my visitors. They now vote in every 12 hour. (60*60*12;)

    # Changing the $offset will just make the file cache more often, which is generally bad.

    That’s good to know. Thanx!

    Got it installed, but don’t find the admin button under MANAGE > (looking for Democrary, but it ain’t there…)

    Running 1.5.1.3, using Connections template. Sidebar code is in, and shows “There are no polls in the database.”

    Entire folder copied into plugings, aka.

    wp-content> plugins> democrary

    Is this correct? Look forward to using this one..

    Hello, I’m using Semiologic 2.5.2. I installed Democracy Alpha4. Apparently, everything was working fine, but when I cast a vote, I get a blank screen with the following error message:

    Hello! The page /&jal_no_js=true you requested is not available

    Any suggestions?

    Here’s some code I found useful with this plug-in.

    I wanted to associate a poll with a particular post, rather than having it visible throughout the blog.

    First, I put the code below in my theme’s index.php, just after the call to the_content(). That’s in the main page, not the sidebar.

    Then I created a poll and noted its number.

    Finally, I added a custom value to the post, called “pollNumber” with the value equal to the poll number.


    <?php
    $pollNumbers = get_post_custom_values('pollNumber');
    if($pollNumbers)
    {
    foreach (get_post_custom_values('pollNumber') as $pollNumber)
    {jal_democracy($pollNumber);}
    };
    ?>

Viewing 15 replies - 1 through 15 (of 89 total)
  • The topic ‘[NEW PLUGIN] Democracy AJAX Poll’ is closed to new replies.