Democracy

Democracy is the ultimate WordPress polling plugin. This document contains a quick guide to using Democracy.

Information

Installation

  1. Upload the entire folder named democracy into the plugins folder (/wp-content/plugins/) of your WordPress installation. Do not use the folder Democracy , use the folder inside it.
  2. Login to your WordPress admin panel, click on Plugins, and activate Democracy.
  3. This step provides instructions for adding Democracy as an item on your sidebar. If you only want polls within posts or pages, you may skip this step and use #6.

    If your theme supports Widgets (if you can navigate to Presentation > Sidebar Widgets):

    1. Upload the widget_democracy.php file to your Widgets folder (/wp-content/plugins/widgets/)
    2. Go to the Plugins panel and activate the Democracy Widget
    3. Go to Presentation, then to Sidebar Widgets, and add the democracy widget to your sidebar by dragging it from Available Widgets to your Sidebar.

    If you don't have widgets:

    1. Open your sidebar.php (/wp-content/themes/***YOUR-THEME***/sidebar.php) file
    2. Add the code: <?php jal_democracy() ?> where you want Democracy to appear.
  4. In your WordPress admin panel, click on Manage, then Democracy Poll. There, you can add polls, edit polls, edit options, etc.

Congratulations! Democracy is ready to go. Below is a list of optional installation procedures.

  1. In your Democracy Poll panel, edit the options at the bottom of the page. Here you can choose to turn off IP logging, order answers by their popularity, and other stuff.
  2. If you want to add individual polls to your posts or pages, write {democracy:*}in the Write screen wherever you want to display a poll. The * corresponds to a poll ID, so if you want to use poll ID 15, you post would resemble bla bla bla bla {democracy:15} bla bla bla. The poll ID can be found in the Democracy Poll admin panel, by looking at the first column of the table of polls. To use the current poll, just write {democracy}.
  3. To create an archives page, create a new Page in (Write > Write Page). Somewhere in the content of this page, add the following where you want the archives to appear: {democracy_archives}

Upgrading

If you have a version of Democracy 1.x, use the following instructions:

  1. Delete the old democracy folder (/wp-content/plugins/democracy/) on your server.
  2. Upload the entire folder named democracy into your plugins folder (/wp-content/plugins/) of your WordPress installation.
  3. In your browser, go to Admin Panel > Manage > Democracy Poll.

Advanced Use

All of the functions listed below can be used with no arguments, as is default. Adding arguments allows you to customize Democracy to a greater extent.

The jal_democracy() function
This function can take some optional parameters:
  1. $id: ID of the poll you want to display. If none is specified, it defaults to 0, which is then converted to mean the current poll (as specified in your admin panel).
  2. $before_title: The HTML that will precede the title (the question) of a poll. If none is specified, it defaults to false, which is then converted to the HTML you specified in the admin panel (or the default if you haven't changed it).
  3. $after_title: The same as $before_title, but following the title. Typically, this is the closing HTML tag of the tag found in $before_title.
Creating Democracy objects
This plugin uses an object-oriented approach for displaying polls. To create a new Democracy object:
  1. $poll = new Democracy($id, $before_title, $after);: uses the same parameters as the jal_democracy() function. See above. The difference is that creating an object does not automatically display the poll.
  2. $poll->display($showVoteScreen);: The display method returns a string of HTML code. The parameter $showVoteScreen is a boolean that decides whether to show the Vote screen or the Results screen. Default: true, but the user must not have already voted or it will show the Results page anyway.
The jal_democracy_archives() function
This function prints a results list of all polls you have created in a list ordered with most recent polls at the top. Use get_jal_democracy_archives() if you want to have your data returned instead of printed. This function can take some optional parameters:
  1. $show_current: Determines whether to show the poll currently in progress now (as specified in Democracy Poll admin panel). If set to true, it will show a normal voting box for the poll (and will show the results page if the user has already voted). The current poll will appear first in the list. If false, as is default, the list will not contain the current poll.
  2. $before_title: The HTML that will precede the title (the question) of each poll. If none is specified, it defaults to false, which is then converted to the HTML you specified in the admin panel (or the default if you haven't changed it).
  3. $after_title: The same as $before_title, but following each title. Typically, this is the closing HTML tag of the tag found in $before_title.
Example Usage
  1. The jal_democracy() function
    <?php
    jal_democracy(25, '<div class="title">', '</div>');
    ?>
    
    This example will print the poll of ID 25 and surround the title of the poll with <div class="title"> and </div>.
  2. Democracy object:
    <?php
    	$poll = new Democracy(9, '<h3>', '</h3>');
    	$poll->active = false;
    	echo $poll->display(false);
    ?>
    
    This example will print the results screen of the poll with ID 9 and the title will appear like: <h3>Example Title</h3>. The $poll->active part makes the poll 'inactive', meaning it can't be voted on. If this code were not there, then a 'Back to Vote Screen' link would appear for users who haven't voted yet.
  3. The jal_democracy_archives() function
    <?php
    jal_democracy_archives(true, '<strong>', '</strong>');
    ?>
    This example will show a list of results on all the past polls. It will not allow users to vote on past polls.

FAQs

How can I customize the look of Democracy?
Democracy uses two CSS stylesheets, basic.css and style.css. CSS stylesheets control the look of your page. The basic.css file contains general Democracy styles that format the poll without specifying colors or other things that vary widely in different websites. The style.css file contains specific styles meant to make Democracy mesh with your site. If you are unhappy with the looks of Democracy, style.css is the file you should edit. I've tried to lay it out so it's easy to change, but if you are unfamiliar with CSS, it may be hard. If you want some specific design, try getting support from the WordPress forum.
Does Democracy validate to XHTML and CSS standards?
It almost always does, but if there's more than one instance of the same poll show on one page and they both show the Vote screen, then it will be invalid. I tried fixing this by only allowing one instance per page but it just wasn't worth it. You should be able to avoid this scenario very easily, and even if it does happen, it's just validation ;-).
How do I get rid of the dots next to poll choices?
Open /wp-content/plugins/democracy/style.css. At the bottom you should see:
/*
.democracy ul li {
list-style: none;
background: none;
}
*/
Remove the /* and */ lines.
When I vote, a whole new page is loaded. It doesn't do the slick in-page loading (AJAX).
This means your theme does not include a vital hook that plugins use to add information to the <head> of your page. To verify this, View Source of a page and see if there is anything that says <!-- Added By Democracy Plugin ... If its not there, edit /wp-content/themes/***YOUR-THEME***/header.php and somewhere in the <head>, add this code: <?php wp_head(); ?>. This code basically allows Plugins to add css and javascript references very easily. MOST themes include it, but some neglect to.

Support

Support is tough. I really want to help everyone, but my busy high school schedule doesn't leave me a lot of time for everyone. That said, you can get support in the following ways.

I read all of my email, but I often don't respond to it. The best way to get me is by AIM, where I can't escape you! :).

If I help you with support, please consider making a small donation. Of course, if you just really like Democracy, you can send one too. Your donation is infinitely appreciated!