January 23rd, 2009

Fixing Popularity Contest for WP 2.7

Popularity Contest by Alex King is a fairly popular WordPress plugin. However, support by the original author was discontinued as of WordPress version 2.5 and above.

Then came along WordPress Guy, who not only released a version of the plugin that works, but also told users what he did to fix the original. A few other people have also done the same thing, but the bottom line is that there is a way to get the plugin to work for WP 2.5+.

However, even after installing that version of the plugin, WP 2.7 users have complained of the fact that the akpc_most_popular_in_cat function doesn’t work as it is supposed to - it simply shows (none) when passed any category other than the first. I have been able to resolve this issue by slightly modifying one line of the code, namely change:


/* At about line 1435 on WP guy’s version */
WHERE tt.term_id = '".intval($cat_ID)."'

To the following line of code:


WHERE tt.term_taxonomy_id = '$cat_ID'

And finally remove the following line:


/* At about line 1439 in WP guy’s version */
AND post_date < NOW()

Of course, if you’re feeling lazy, you could just download the modified plugin here.

There you go, that should fix the most popular in category display function as well as a couple of other issues. In case this doesn’t help, use the comment section to complain - maybe I’ll get around to fixing your problem.

Otherwise, enjoy your now working plugin!



 , ,

One Response to “Fixing Popularity Contest for WP 2.7”

  1. At 10:12
    On 29th Jan 2009,
    Enrico wrote:

    Thanks for the fix. Its great to see the open source philosophy alive and well.

    The modified plugin file you provide doesnt seem to want to install. Is it a patch?

    Is there any particular reason you remove
    AND post_date < NOW()
    doesn’t that just filter out posts that are scheduled to post in the future?

    Thanks again,
    Enrico

Leave a Reply

This website and it's contents are licensed by Creative Commons.