Popularity Contest Couldn’t Be Activated? Get Fixed!

Display­ing your most pop­u­lar posts is an excel­lent way to draw your read­ers into your blog to oth­er posts proven to be enjoyed by oth­er readers.

And with Word­Press, it seems like there are two pri­ma­ry ways to deter­mine which posts should be con­sid­ered pop­u­lar: the num­ber of hits that they get or the num­ber of com­ments that they get.

Some plu­g­ins list the posts which are com­mend­ed upon the most. Oth­ers keep track of vis­its (or tie in to a stats plu­g­in) to deter­mine the most popular.

While those ways are good, they each only take into account part of the pic­ture; after all, is not a post’s pop­u­lar­i­ty deter­mined both by com­ments & vis­its?

Enter Pop­u­lar­i­ty Con­test, a won­der­ful lit­tle Word­Press plu­g­in which — through plen­ty of math­e­mat­i­cal voodoo — tracks a page’s pop­u­lar­i­ty based on direct vis­its, views on the home page or with­in an archive, views in a feed, and com­ments, Track­Backs, and PingBacks.

Unfor­tu­nate­ly, using Pop­u­lar­i­ty Con­test on more recent ver­sions of Word­Press has been made a bit more dif­fi­cult by the fact that the two are incompatible.

When acti­vat­ing Pop­u­lar­i­ty Con­test here, I was met with a very unhelp­ful mes­sage about the plu­g­in not being able to be acti­vat­ed due to a fatal error.

A cou­ple of mod­i­fi­ca­tions to the Pop­u­lar­i­ty Con­test 1.3b3 file had to be made to get it to work. You can down­load the mod­i­fied Pop­u­lar­i­ty Con­test file if you would like, or you can make the changes yourself.

If you pre­fer to down­load the plu­g­in file from Alex King’s site, you’ll need to make these mod­i­fi­ca­tions to it using a basic text or code edi­tor (not a rich text editor):

  • Find:
    require('../../wp-blog-header.php');
  • Replace with:
    @require('../wp-blog-header.php');
  • Find:
    if (isset($_GET['activate']) && $_GET['activate'] == 'true') {

  • Replace with:
    if (isset($_GET['action']) && $_GET['action'] == 'activate') {

After sav­ing the mod­i­fied popularity_contest.php file (or extract­ing the file from the archive you down­loaded from here), upload it to your wp-content/plugins/ fold­er and acti­vate it in the Plu­g­ins pan­el of your blog.

Works like a treat, no?

5 thoughts on “Popularity Contest Couldn’t Be Activated? Get Fixed!”

  1. Sweet I was just play­ing around with ‘pop­u­lar’ plu­g­ins and this does seem good on paper…will test out the amend­ed version ;)

  2. Rick, You are tru­ly a mas­ter­mind. I was try­ing to add to my sid­bar based on the code givin in the plu­g­in, All I seem to get is a error, this is the code I was using,

    Most Pop­u­lar Posts

    akpc_most_popular_in_cat($limit = 10, $before = , $after = , $cat_ID = cur­rent category)

    Any Ideas?

  3. Mike: I think what you need to do is some­thing more like this:

    akpc_most_popular_in_cat(10);

    The para­me­ters list­ed in the exam­ple code need to be replaced with your vari­ables for them; in this case, unless you want to mod­i­fy any of them, you can leave it at just 10. Actu­al­ly, you prob­a­bly don’t even need that.

Leave a Comment

Your email address will not be published. Required fields are marked *

Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

Comments must be made in accordance with the comment policy. This site uses Akismet to reduce spam; learn how your comment data is processed.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Rick Beckman