The fix for “Plugin could not be activated because it triggered a fatal error” in the Popularity Contest WordPress plug-in

One of the important things about having a blog is giving your users something to do ‘next’. After you get them to your page and they finish reading the post, where do you want to send them? Hopefully they will stay and read a little longer. How will they know what others find interesting? A lot of sites I have visited have a ‘popular post’ list in the sidebar.

OK, that sounds great but there are not a lot of popular post plug-ins available for WordPress. The one that I did find ( Popularity Contest ) that looked like it would fit the bill perfectly was not working for WP > 2.5. What did I do next? Search Google! What I found was a site that showed you exactly how to get Popularity Contest working for WP > 2.5.

TTC – Tips and Tricks gave the specific instructions that I needed to get this plug-in ready to install and use. Why do I say “ready to install” and “use”? Well becasue you need to fix this plug-in in two places. The first fix is so you can use the plug-in, and the second fix is so you can install the plugin creating the tables necessary in your database.

NOTE: I have attached the modified code at the end of this post, if your intrested in how to fix it yourself, read on.

If you try to install this plugin without the fix, you will get “Plugin could not be activated because it triggered a fatal error.”

Now to the code: Look at line 59 of the popularity-contest.php file

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

and change it to

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

NOTE: The @ will keep your logs from filling up with error messages

This will fix your install problem. If your installing this plug-in for the first time read-on.

Look at line 1528 of the popularity-contest.php file

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

and change it to

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

You should be good to go.

You must log in to access this file.
To download this file you must right click and select Save As

Log in
Download: Popularity Contest (7)

Comments

  1. Shackbase says:

    This fix makes it possible to install Matt’s Popularity contest plugin.

    Excellent work Dave and Thank you!

    Tony Lindskog
    WordPress Views

  2. David says:

    @Shackbase Your welcome!

Trackbacks

  1. [...] a previous post I talked about how to make the Popularity Contest plug-in work with WordPress > 2.6. This post [...]

Speak Your Mind