Democracy Poll

Democracy Poll is a plugin for b2evolution that adds a poll to your blog's sidebar. You can create and edit polls in the Tools > Democracy tab of the b2evolution backoffice. If the user has JavaScript enabled, their vote is sent without refreshing the whole page. Results can be displayed as a pie chart or as a bar graph.

Original Wordpress plugin by Andrew Sutherland

Ported to b2evolution by Danny Ferguson

Version: 1.2

Released under the CC GPL 2.0

Features

Installation

Requires b2evolution 1.8 or later

  1. Put the democracy_plugin directory plugins directory.
  2. Go to Settings > Plugins and click install next to where it says Democracy Poll.
  3. For each skin you want the poll to appear in, add some code to the _main.php file.
    1. Wherever you want the poll to appear (usually the sidebar), add this:
      <?php $Plugins->call_by_code( 'democrcy', array() ); ?>
  4. Now go Tools > Poll and manage your polls. Any user that has permission to edit the properties of a blog can manage polls for that blog as well.

Customization

You can add some parameters when you call the plugin, so that each skin can display it differently. Here's an example, that adds all of the parameters with their default values.

<?php $Plugins->call_by_code( 'democrcy', array( // Add parameters below:
        'block_start' => '<div class=bSideItem">', // Your skin may use another class for sidebar blocks
        'block_end' => '%gt;/div>',
        'title' => '<h3>'.T_('Poll').'</h3>', // Set to '' if you don't want a title
        'before_q' => '<strong id="poll-question">', // Change how the question looks
        'after_q' => '</strong>',
        'archive_link' => false, // Set this to true after you set up for archives (see below)
        'gft' => true, // Set to false and winning option is 100% of the graph, and other answers are a percent of that
        'gct' => '#06c', // Color for graph bars top
        'gcb' => '#05a', // Color for graph bars bottom. Make it a bit darker than the top, for a slight 3d effect
) ); ?>

You only need to define parameters when you don't want to use the default. So, if you only wanted to change the bar color, then this would do that and leave everything else at its default value:

<?php $Plugins->call_by_code( 'democrcy', array( 'gct' => '#F00', 'gcb' => '#D00' ) ); ?>

Archives

You can add a link that lets you see all of the old polls, but it requires one more edit to the _main.php file. Find the part of the file says "switch( $disp )", and add one more case to the bottom of that list:

case 'pollarchives':
        // this includes the poll archives if requested
        echo '<div class="bPost">';
        $Plugins->call_by_code( 'democrcy', array( 'display' => 'archives' ) );
        echo '</div>';
break;

Any parameters that you want to edit will have to be specified again here. So, if you changed the color of the graph bars in the sidebar, you'll have to define the new color here as well. Once you've added this code, set the 'archive_link' parameter to true in the sidebar, and you'll get a link that displays the archives in the main column of your blog. This plugin call takes a special parameter, too. If you set 'allblogs' => true, then it will show old polls from all blogs, not just the blog that's displaying the poll.

More help

For further help please visit the page for this plugin at AtonishMe.