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!

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!
Digg This | Stumble it | Add to Del.icio.us | | Print This

There Are 18 Responses So Far. »

  1. 1 P7
    Thursday, June 5th, 2008 at 5:36 am

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

  2. 2 Remkus
    Thursday, June 5th, 2008 at 9:30 am

    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. 3 Thaya Kareeson
    Thursday, June 5th, 2008 at 12:31 pm

    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. 4 Susan
    Thursday, June 5th, 2008 at 3:39 pm

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

  5. 5 Keith Dsouza
    Thursday, June 5th, 2008 at 4:36 pm

    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. 6 Leland
    Thursday, June 5th, 2008 at 6:00 pm

    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. 7 Thaya Kareeson
    Thursday, June 5th, 2008 at 6:04 pm

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

  8. 8 Kyle Eslick
    Thursday, June 5th, 2008 at 7:32 pm

    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. 9 wang adsense
    Thursday, June 5th, 2008 at 7:40 pm

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

  10. 10 Thaya Kareeson
    Thursday, June 5th, 2008 at 7:54 pm

    @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.

  11. 11 Chicken Say
    Friday, June 27th, 2008 at 11:16 am

    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. 12 Chris
    Thursday, November 13th, 2008 at 4:16 am

    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. 13 Ed Torres
    Thursday, November 20th, 2008 at 3:44 pm

    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. 14 Adrian R.
    Wednesday, November 26th, 2008 at 9:42 am

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

  15. 15 Guillermo
    Tuesday, December 9th, 2008 at 3:12 pm

    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’);

  16. 16 Guillermo
    Tuesday, December 9th, 2008 at 3:52 pm

    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.



Leave A Comment