The problem(s): With some upgrades of the WordPress 2.5 branch, the Popularity Contest WordPress plugin is not working properly. Also, people trying to activate the Popularity Contest plugin on a brand new WordPress install are getting a fatal error or a “doesn’t exist” message when attempting to activate the plugin.

The solution(s): I actually ran into this problem on a fresh install of WordPress. After several attempts, I was unable to figure out the problem myself. Thankfully, a quick Google search showed a post over at WPGuy which gave details on fixing both problems!

Here is what you need to know if you have this problem:

Fix problems with the upgrade to WordPress 2.5

Open your Popularity Contest plugin (edit it) and search for this code:

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

And replace it with this:

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

Fix problems with a new install of WordPress 2.5

In addition to doing the above, you need to search for the following code:

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

And replace it with this:

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

I went through both of these steps on my fresh WordPress install and it fixed the problem perfectly!

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching WPHacks.com as a place to share hacks, tutorials, etc. Connect with Kyle on Twitter or Google+!

  1. P7 says:

    Thanks, I was looking to fix this for quite sometime. P7

  2. Remkus says:

    I was looking for the answer to it just as well, but it did absolutely nothing for me. I tried to use both hacks but all I ended up with was an error message: Table ‘corpblogwp.wp_ak_popularity_options’ doesn’t exist on line: 124

    No clue, whatsoever :S

  3. It’s sad that a lot of Alex King plugins are no longer supported leaving all of us hanging dry. I have packaged this fix and a fix to make Popularity Contest cacheable here. I’ve notified Alex of these fixes and hopefully he can incorporate these fixes into his next release of Popularity Contest.

  4. Susan says:

    Awesome, I didn’t know about the 2nd part you added. This is great, thanks for this!

  5. Keith Dsouza says:

    This is a great tip, I was hoping for the author of the plugin to update the plugin but this definitely saved me a lot of hassles.

  6. Leland says:

    I thought my popularity contest was broken because of the WP-SuperCache, not because of WP 2.5. Guess it’s because of both! Thanks for the post.

  7. @Leland
    You’re welcome. Please feel free to provide any feedback you have.

  8. Kyle Eslick says:

    Glad everyone found this post useful. Like I said above, I only found it because I was having the same problems.

    I know Alex is busy, but it would indeed be great if someone took over supporting his plugins? He has a few that are almost required with any WordPress install.

  9. @Kyle Eslick
    I would love to take over support for Popularity Contest as I already learned a lot of its internals, but the last time I chatted with him, it seems like he’s not ready to let it go yet. The only thing I can do is maybe come up with a better statistics plugin and publish that instead.

  10. wang adsense says:

    Great, I been a while since my site lost their popular post.
    Thanks for the guide.

  11. Chicken Say says:

    Thanks for the tip…i was going to fix it myself but lazy to read thru the code again…luckily i found this page… :P

  12. Chris says:

    I’ve changed both lines of code but still can’t get it to work under WordPress 2.6.3

    Any ideas will help.

  13. Ed Torres says:

    Same problem here with WordPress version 2.6.3.

    Besides the changes suggested here I also created a php.ini file at wp-admin folder and added this following line: memory=20MB (due to memory limitations of my ISP).

    I am getting this following error:

    “It was not possible to activate the plugin due to a fatal error.”

  14. Adrian R. says:

    Yup, the same problem for me with WordPress 2.6.3. Any idea how to solve it?

  15. Guillermo says:

    Better to use the ABSPATH constant provided by WordPress:

    require(ABSPATH.’/wp-blog-header.php’);

    so that the WP files can reside inside a directory.

  16. Guillermo says:

    I patched popularity contest using the proposed fix. This plugin is running in WPMU. It seems to work, but the error_log file in the plugins directoy of WPMU contains hundreds of lines like:

    [09-Dec-2008 13:07:40] PHP Fatal error: require() [function.require]: Failed opening required ‘../wp-blog-header.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home1/webdir/public_html/wp-content/plugins/popularity-contest.php on line 59

    I fixed it like this:

    require($_SERVER[‘DOCUMENT_ROOT’].’/wp-blog-header.php’);

Trackbacks/Pingbacks »