Vote It Up (Wordpress plugin)

This plugin enables voting functionality on your blog.

Download

Suggestions on this plugin are welcomed at the Forums. No registration is required. Alternatively, you could just drop me an E-mail at Ready725 atgmail.com.

Vote It Up!

Description

This plugin adds voting functionality for posts. This function is similar to Reddit or Digg, in that visitors can vote for and against. Votes for the post will fill up the bar (in blue), while votes against the post will empty the bar.

By default, it takes 40 votes to fill the bar completely. Alternatively, a ticker style can be used to mimic the ticker seen on Digg. The ticker style shows the actual vote count.

Guests can also vote for posts. This functionality can be disabled as well. Members voting for posts will have their posts recorded, and the list of votes can be retrieved using the GetUserVotes() function.

Installation

By installing the plugin, you agree to Tevine's policies.

  1. Upload the "voteitup" folder into the "/wp-content/plugins/" directory. The folder should consist of several files:

    • readme.txt
    • voteinterface.php
    • voteitup.php
    • voteoptions.php
    • voterajax.php
    • votingfunctions.php
  2. Login to your Wordpress Administration Panel

  3. Go to the plugins tab, and activate the "Vote It Up" plug-in. The plug-in will install some things to the database on its first run. If there are no error messages, the plugin is properly installed.

  4. You can choose which of the following ways you want to represent the votes as. You will need to insert the relevant code into the WordPress loop.

    Bar
    <?php DisplayVotes(get_the_ID()); ?>

    Ticker
    <?php DisplayVotes(get_the_ID(), "ticker"); ?>

  5. You can customize these options by editing options in the Wordpress Administration area (Options > Vote It Up).

  6. You can add the Top-Voted widget to display the most popular posts. Probably a good way to expose your better pieces of work. You can do this via adding <?php MostVotedAllTime(); ?> at the place where you want it to be displayed (need not be in the Wordpress loop).

Feel free to poke around the internals of the plug-in.

Frequently Asked Questions

This plugin doesn't seem installed properly

If the plugin cannot write to the database, you can try manually executing the below SQL queries (you can use phpMyAdmin to do this):

CREATE TABLE `wp_votes` (
      ID int(11) NOT NULL auto_increment,
      post int(11) NOT NULL,
      votes text NOT NULL,
      guests text NOT NULL,
      usersinks text NOT NULL,
      guestsinks text NOT NULL,
  PRIMARY KEY  (`ID`)
);

CREATE TABLE `wp_votes_users` (
      ID int(11) NOT NULL auto_increment,
      user int(11) NOT NULL,
      votes text NOT NULL,
      sinks text NOT NULL,
  PRIMARY KEY  (`ID`)
);

CREATE TABLE `wp_votes_comments` (
      ID int(11) NOT NULL auto_increment,
      comments int(11) NOT NULL,
      votes text NOT NULL,
      guests text NOT NULL,
      usersinks text NOT NULL,
      guestsinks text NOT NULL,
  PRIMARY KEY  (ID)
);

For other problems, you may want to ensure that there are no missing files, and that you have followed instructions in this Read Me file

I want a totally customizeable version

If you want to customize the bar completely, you can treat the bar as two different parts. The vote count:

<span id="voteid"><?php echo GetVotes(get_the_ID()); ?></span>

The vote link:

<span id="voteid<?php the_ID(); ?>">
<?php global $user_ID;
if(!UserVoted(get_the_ID(),$user_ID) && !GuestVoted(get_the_ID(),md5($_SERVER['REMOTE_ADDR']))) 
{ ?>
<a href="javascript:vote_ticker(<?php the_ID() ?>,<?php the_ID() ?>,<?php if ($user_ID != '') { echo $user_ID; } else { echo 0; } ?>,'<?php bloginfo('url'); ?>');">Vote</a>
<?php } ?>
</span>

From there, you can customize it. These two parts need to be placed in the Wordpress loop. Note that the following options will not be in effect: -Vote text -Sink text

Is there any limit to the number of votes?

There is no limit as to how many votes for each post can take. The vote count can also go into the negatives as well.

However, there is a technical limit of approximately 8000 votes for a post. This limit can be overcomed by running the following SQL query in PhpMyAdmin:


	ALTER TABLE `wp_votes` CHANGE `guestsinks` `guestsinks` LONGTEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL 
	ALTER TABLE `wp_votes` CHANGE `guests` `guests` LONGTEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL
Running this allows more votes to be stored, at a cost of using up more memory per post. Only use this if you receive a large number of votes for your site.

Screenshots

Here are some possible forms of the voting area:

Some main versions

Variant 1
Variant 2
Variant 3
Variant 4

Theme Support

Currently 3 themes are bundled. Images are as followed:

Vote It Up Bar
Bar

Vote It Up Ticker
Ticker

Vote It Up Modern Ticker
Modern Ticker

If you have made a custom theme and you would like to publicize it here, please contact me at Ready725 atgmail.com.

Widget Support

Most Voted Widget

The Most Voted Widget can be installed as a widget on widget-ready themes.
Alternatively, you can add the following code to your template if it does not support widgets: <?php MostVotedAllTime(); ?>.

The widgets are also theme supported. You can disable theme support for the widget by using this code instead: <?php MostVotedAllTime("default"); ?>

Requirements

  1. A working Wordpress install

  2. Your WordPress theme must contain a call to the get_header() function

  3. Your WordPress theme must contain the Wordpress loop

Most Wordpress installs have these, so you need not worry about these.

In addition, to be able to vote, one must have JavaScript enabled in the browser.

Customizing

Within votingfunctions.php, there are several functions that can shows other information.

GetVotes($post_ID) Returns the number of votes associated with the post.

UserVoted($post_ID, $user_ID) Returns TRUE if the user already voted for the post, FALSE if the user hasn't voted for the post

GetPostVotes($post_ID) Returns an array of user IDs that have voted for the post.

GetPostSinks($post_ID) Returns an array of user IDs that have voted against the post.

Changelog

1.0.7 - Added theme support, added compatibility file, added further support for Wordpress 2.5 interface.
1.0.6 - Fixed file paths.
1.0.5 - Fixed file paths.
1.0.4 - Added "Most Voted" widget.
1.0.3 - Fixed Guest Voting, now guests votes can go more than 2. Easier update: Replace votingfunctions.php.
1.0.2 - Some minor bug fixes
1.0.1 - Fixed Guest Voting
1.0.0 - Initial

Download

© 2007-2008 Tevine | Policies | Credits