WordPress Guy

Popularity contest plugin and WordPress 2.5

One of my favorite plugins is Alex King’s Popularity Contest. Unfortunately it doesn’t seem to work with the latest WordPress release 2.5, nor Wordpress 2.5.1.

Fixing Problem #1

By doing a little searching on WordPress.org Forums I found this post which explains how to fix the Fatal Error problem I’ve been getting. What you need to do is change the line 59 of the popularity-contest.php file from this:

require('../../wp-blog-header.php');

to this:

require('../wp-blog-header.php');

Ok so, that fixed the fatal error problem, and those of you who had the plugin installed prior to updating to WordPress 2.5 shouldn’t have any other problems.

However, if you’re installing the plugin for the first time you might be getting another error ‘Table ‘database.wp_ak_popularity_options’ doesn’t exist on line: 124‘.

Fixing Problem #2

You can choose to create the database manually like Ken McGuire explains in this article.

That works, but it’s a little complicated, so I came up with my own solution.

All you need to do is open the ‘popularity-contest.php’ file go down to the line 1528 and change this:

if (isset($_GET['activate']) && $_GET['activate'] == 'true') {

for this:

if (isset($_GET['action']) && $_GET['action'] == 'activate') {

You can also download the modified plugin:

Popularity Contest for WordPress 2.5

That’s it, you shouldn’t have any other problems now. Enjoy!

Update:

As Marco pointed out, the solution to the first problem could fill your error_log with warning messages. To fix that change the “require(’../wp-blog-header.php’);” for:

@require('../wp-blog-header.php');

Comments

  • Great tip, I have been looking for a few days to get my plugin sorted and the second part of this tut, sorted it. thanks.

    Rod Thomas May 9th, 2008 at 9:04 am
  • Thanks, solved my problem!

    Alex May 11th, 2008 at 3:24 pm
  • Thanks bro it works like a charm, may you have long life with happiness and joy.

    Abi Bakar May 12th, 2008 at 11:26 pm
  • thanks i download the patch and it is work done

    العاب May 13th, 2008 at 5:24 pm
  • Thanks for your work on this. I’ve been working on popularity contest for two days with no luck. Your patch did the trick.

    braddock May 13th, 2008 at 10:35 pm
  • Hi,

    I am also very interested in getting Popularity Contest to work under 2.5.1, because obviously and unfortunately, Alex King hasn’t presented a new version yet.

    But considering your modifications:
    what about this comment and Alex’s answer?
    http://alexking.org/blog/2008/03/30/wordpress-25-plugin-compatibility#comment-62323

    Marco Luthe May 15th, 2008 at 12:06 am
  • @Marco Luthe: I hadn’t noticed those errors, thanks for the heads up. I’ve been playing around with the plugin for a little while and I noticed the errors only come up when loading pages in the admin section (where the plugin doesn’t really need that require statement, that’s why the error given is just a warning by the way). So… I would add a @ right before the require, to avoid the warnings and hope that Alex King will release the official 2.5 compatible version.

    Wessley Roche May 15th, 2008 at 10:29 am
  • Thank you for solving this problem — It worked fantastic!!!

    FD Musser May 17th, 2008 at 6:38 pm
  • Ahhh — relief at last! This one was really stressing me out thanks for the fix.

    Ed Rivis May 18th, 2008 at 9:23 pm
  • Wow.. it’s working like a charm!. Thank you indeed WPGuy!
    Cheers!

    MhawSayar May 20th, 2008 at 8:07 pm
  • Awesome..thanks for putting this out there. It works great.

    I was really racking my brain until I found this. Thanks again!

    Eric Nelson May 24th, 2008 at 8:54 pm
  • I have been trying to fix this all day, and I couldn’t figure it out…

    You’re fix worked with line 1528….THANK YOU!!!!

    cg May 25th, 2008 at 8:42 pm
  • Thank you, I almoste love you.

    Helena May 27th, 2008 at 10:59 pm
  • thanks a lot a got it working on one of my new blog. i really appreciate your effort and help.

    pinoymaritime May 29th, 2008 at 3:14 pm
  • THANKS SO MUCH!!!!!!!!! The “replacing the require field” trick didn’t work but the modified plugin worked for me.
    Thank you!!!!!!!!!!!!!!!!!!!

    Gautam May 29th, 2008 at 7:45 pm
  • It worked for me! yey, thanks so much!

    I have several questions though
    – is there a way to exclude a particular category and not show up on the list?
    – how to add a date below the title link?

    Any thoughts?

    donalyza June 2nd, 2008 at 4:46 am
  • thank man
    working

    asian beauty talk June 3rd, 2008 at 10:22 pm
  • I was waiting to fix this issue for quite sometime. Thanks P7

    P7 June 5th, 2008 at 12:35 pm
  • I can get the plugin work on WP 2.5.
    I use mandigo themes : http://www.onehertz.com/portfolio/wordpress/

    wang adsense June 6th, 2008 at 3:51 am
  • THANKS!! Nothing else worked (tried 4 other “patched” versions!)… you da’ man!!
    corewerkz

    corewerkz June 6th, 2008 at 7:13 pm
  • Hi. Just wanted to say thanks. The fixes posted did not work for me but your mod worked just fine! Many thanks for posting it.

    Catherine Helzerman June 11th, 2008 at 7:21 pm
  • Woowo!!! Works like charm, dude!!!
    Thanks so much.

    PS: If you have time to spare, can you help me with this:
    http://wordpress.org/support/topic/181355?replies=5

    gofree June 15th, 2008 at 3:06 pm
  • Well, still did not work for me on a fresh 2.5.1 WP install…

    Mike June 17th, 2008 at 4:25 pm
  • i can’t get mine to work either. mine’s not installed on the root directory but i altered it to be: ‘../news/wp-blog-header.php’ and everything in between and it still pulls a Fatal Error.

    i’m using WordPress version 2.5.1.

    groonk June 18th, 2008 at 1:37 pm
  • @Mike & Groonk: I’m sorry my solution doesn’t work for you. I’ll see if I can find out why it isn’t.

    Wessley Roche June 18th, 2008 at 6:56 pm
  • I tried the original solution and it didn’t work for me then I read about the complicated solution where you have to edit your own database tables but didn’t have a clue what they were talking about. I’m so glad you posted this solution, its quick simple and it works - what a lifesaver! I hope othe people can find this fix cos its taken me months to find a solution after reading the same fix over and over again on other peoples sites. Cheers Mate top work!

    Pitchslap June 24th, 2008 at 3:37 pm
  • Thanks, for the best guideline how to fixed the error. I search more than 5hrs to solve the error. last I find-out your guideline and I currect within a min. your are realy grate.

    gajan siva June 26th, 2008 at 9:11 pm
  • Thank you very much! Worked like a charm. :)

    Amanda June 27th, 2008 at 12:26 pm
  • You’re the man, Work like a charm to me. Thanks you very much.

    pinoyconsole June 28th, 2008 at 12:33 am
  • Many thanks!! it work :)
    Greetings from Italy

    Romano June 28th, 2008 at 7:24 am
  • Thank you!
    I did not go well, but was settled immediately.

    I thank you very much.

    ke June 28th, 2008 at 7:46 am
  • Brilliant! Thanks for rescuing one of my favorite plugins.

    Chris July 1st, 2008 at 4:51 am
  • thanks for making this so easy, worked just right for me too

    Ben July 1st, 2008 at 8:03 pm
  • Excellent! Thx for your support with this. Again we can use a ‘popular’ plugin!

    Sam July 1st, 2008 at 9:55 pm

Your Comment