My Popularity Contest plugin for WordPress has been “broken”1 for more than a year (since the WordPress 2.5 release I believe). Luckily, the great WordPress community found and posted work-arounds and most people had working versions while updating the plugin sat on my to-do list.
The main issue with updating it was that I felt that the old implementation was somewhat broken. It didn’t work with caching, it didn’t handle tags and other new features introduced in recent versions of WordPress. In short, it needed a rewrite. And that is what it got in version 2.0.
- This version is completely cache compatible. It uses JavaScript and image loading techniques to do the view counting. It also has a nice widget options for showing various reports on the front-end.
- There is now an option to exclude views from site authors, which was a commonly requested feature.
- The back-end reports have been redone a bit, and tag reports still need to be added. Those will take a little more work to implement properly.
- We also updated the code to use more official WordPress API functions (many of which didn’t exist when this plugin was originally created).
It’s been a good deal of work getting it all updated and ready for release, but hopefully this version will work better than ever for everyone.
This is a beta release because it hasn’t had widespread testing (yet). Your feedback is requested – please let me know if you run into issues. Posting issues in the comments here is ok for this one.
The download and more information are available on my WordPress Plugins page.
If you have any general trouble with this, please contact the WordPress HelpCenter or you can try the WP Support Forums.
- Did not work on versions of WordPress greater than 2.3. [back]
Popularity: 1% [?]

Elan adds this Comment:
Get the following error when trying to activate:
Plugin could not be activated because it triggered a fatal error.
Fatal error: Cannot redeclare class ak_popularity_contest in /home/shudnown/public_html/wp-content/plugins/popularity-contest/popularity-contest.php on line 129
June 17th, 2009 at 8:37 pm
Elan adds this Comment:
Ok, just refreshed and immediately saw beta3 available and that works.
June 17th, 2009 at 8:38 pm
King Rat adds this Comment:
I get the following error on my reports page:
Warning: Invalid argument supplied for foreach() in /home4/kingratb/public_html/reading/wp-content/plugins/popularity-contest/popularity-contest.php on line 1340
June 18th, 2009 at 8:16 am
ZB adds this Comment:
Hi. The plugin update is in conflict with Ajax Edit Comments and when I try to delete a comment on a post it shows this warning. Can you help solving this?
Warning: Missing argument 3 for ak_popularity_contest::edit_feedback(), called in /home/tvdepend/public_html/wp-content/plugins/popularity-contest/popularity-contest.php on line 1975 and defined in /home/tvdepend/public_html/wp-content/plugins/popularity-contest/popularity-contest.php on line 751
1
June 18th, 2009 at 2:06 pm
Kyle adds this Comment:
When are we going to get the option to exclude certain posts?
I have one posts that is at 100% and the rest of the top 25 are from 20% to 8%. I don’t want to delete the one post that is really popular, but it would be cool to remove it from being counted.
June 18th, 2009 at 2:23 pm
Kyle adds this Comment:
Actually an easy fix is to only display from the past 30 or 60 days when listing popular posts on a widget.
As usual you were way ahead of me. Thanks for the update!
June 18th, 2009 at 2:25 pm
John W adds this Comment:
On the report page, “Averages by Category” is actually displaying averages by Tags. …. all 653 of them for me.
June 18th, 2009 at 2:50 pm
John W adds this Comment:
Pages are being included in stats. Is there a way to exclude all pages?
June 18th, 2009 at 2:55 pm
Alex adds this Comment:
Thanks for the reports, all of these items are resolved in the current version in SVN and will be in the next release.
June 18th, 2009 at 9:32 pm
Claude adds this Comment:
Thanks for the update Alex.
The script added by line #2113 should be excluded when the API is turned off.
//don't include IDS script when API is not in use
if (AKPC_USE_API) {
$str .= 'AKPC_IDS += "'.$post->ID.',";';
}
June 19th, 2009 at 4:24 am
Alex adds this Comment:
Thanks, also fixed in SVN.
June 19th, 2009 at 6:39 am
David adds this Comment:
The text below is showing up on my front index page. If the post doesn’t have much text, you can see this at the end of the description for each post – AKPC_IDS += “xxxx,”; where xxxx= different # depending on the post. How do I stop that from showing. Only started after upgrading to 2.0b1.
Thanks in advance for your help.
June 19th, 2009 at 9:47 am
Alex adds this Comment:
Sorry, I can’t reproduce this David.
June 19th, 2009 at 11:15 am
kevin adds this Comment:
I am still getting the Error: Popularity contest cannot be installed. message. Basic 2.8 upgrade and the plugin insists on not working. Any workarounds? Help!
June 19th, 2009 at 5:12 pm
Alex adds this Comment:
You might have a database permissions problem – I recommend contacting the WordPress HelpCenter.
June 19th, 2009 at 5:24 pm
kevin adds this Comment:
Can you give me a reference for the files touched by your plugin? Happy to chase the db issues myself..
June 19th, 2009 at 5:34 pm
kevin adds this Comment:
Whatever it was, the fix in my case was to drop the options table from the db. Reinstalled. Works. Great plugin, thx.
June 19th, 2009 at 5:46 pm
David adds this Comment:
Alex,
Here is the link to my site – http://www.blackberr[...]rmfront.com/. Look at the end of the shorter posts on the main page, you will see, AKPC_IDS += “xxxx,”. If you go into the actual post it’s not present. Any ideas, I’ve been trying to fix myself to no avail.
Thanks!
June 20th, 2009 at 5:06 am
Carmine adds this Comment:
Version 2.0b1 loads fine, but them totally locks Wordpress 2.8.
June 20th, 2009 at 8:05 am
Alex adds this Comment:
David – this is likely an issue with your theme. I’d recommend debugging the theme or contacting the WordPress HelpCenter.
Carmine – sorry, can’t reproduce this. I recommend contacting my friends at the WordPress HelpCenter – they can help you figure out what the issue is.
June 20th, 2009 at 8:12 am
Popularity Contest終於更新了 | 腦花 adds this Pingback:
[...] Popularity Contest是比較著名的wordpress統計插件,在此次更新前一直存在一個導致無法啟動的問題,其實也是一個非常簡單的問題,在代碼裡稍作修改即可。但插件作者一直沒做修改。此次Popularity Contest直接更新到2.0版本,首先就是解決了上述的問題,而且也增加了一些功能。 [...]
June 20th, 2009 at 9:25 am
Greg Thompson adds this Comment:
I’m having the same issue as Kevin where he updates and gets the message:
Error: Popularity contest cannot be installed.
This takes over the whole WP page load and the only way to get the site back is to upload the old version of Popularity Contest… then everything is fine.
Kevin said he dropped his options table from the db and reinstalled?!? That’s crazy; this is an established site. I shouldn’t have to drop my WP options table and config all over again just because of one plugin update.
What’s really going on here? All my other plugins update perfectly and WP has full access to its own database.
June 21st, 2009 at 10:27 pm
Alex adds this Comment:
That message will occur if Popularity Contest cannot create/update the database table it needs. I recommend contacting the WordPress HelpCenter if you need assistance resolving that issue.
June 22nd, 2009 at 5:51 am
graywolf adds this Comment:
since you’re only interested in shuffling people off to some paid help service why not a link to the old working plugin
June 23rd, 2009 at 5:32 am
Dave Slusher adds this Comment:
Since Alex was not interested in figuring out why the automatic upgrade was killing some people’s blog (like mine), I sat down and figured it out myself. For the record, the problem was bad logic in the plugin not database permissions or all the other things that Alex was trying to send people to Wordpress Help Center for. If you had the table but it was empty, like you had only defaults, it would kill the blog with the wp_die. Bad bad bad thing to do from a plugin.
http://www.evilgeniu[...]ll-of-shame/
June 23rd, 2009 at 5:44 am
Dave Slusher adds this Comment:
I had an existing install of popularity contest and an existing wp_ak_popularity_options table with zero rows in it. I’m assuming that everyone with the problem has this situation. You are calling wp_die on that situation which previous installs can validly arrive at. This is a big big problem.
June 23rd, 2009 at 6:05 am
Alex adds this Comment:
@graywolf – the older version of the plugin will not install on versions of WordPress 2.5 and later.
@Dave – I can’t reproduce this yet, but will give it another try. wp_die() is a very valid thing to call as a plugin dev. Also remember, this is a beta – expect bugs. That’s why you release a beta – to find them!
WordPress HelpCenter provides support for my plugins – which is a lot better than the previous situation where no one did.
June 23rd, 2009 at 6:22 am
Popularity Contest: Wordpress Plugin Hall of Shame | Evil Genius Chronicles adds this Pingback:
[...] that unless seeing a “b” in the version number was supposed to communicate that. Over on his plugin page, Alex King defends the use of the wp_die call as being reasonable. I don’t see that rendering [...]
June 23rd, 2009 at 3:18 pm
graywolf adds this Comment:
@alexking yes but how about for all the people on 2.8 when your plugin goes into “auto update” mode and kill’s their blogs.
I get that there will always be some whacked out config, but at this point that doesnt seem to be the case.
June 24th, 2009 at 5:12 am
Alex adds this Comment:
This is definitely a “whacked out config” situation. I still can’t get the data condition that can trigger this issue to happen unless I manually go in to MySQL and delete all the rows in a certain table. It’s an edge case that wasn’t caught in testing – bugs happen.
Now that this particular issue has been described and replicated, the code for this issue is already changed in local testing and will be different for the next release.
Having full knowledge of the situation (including a number of things that are probably unaccounted for by those complaining rather loudly) I feel very comfortable with the decisions made that led to this situation. All decisions were made in good faith.
June 24th, 2009 at 6:02 am
Greg Thompson adds this Comment:
Hi Alex,
I took the risk to try upgrading to the new 2.0b2 version as soon as I saw it on my list of available updates and… it worked! No more “Error” and dead blog.
Whatever you did to fix it worked for me.
Thank you for the timely update.
–Greg
June 25th, 2009 at 8:01 am
Alex adds this Comment:
I’m closing comments here since this release is now obsolete.
June 26th, 2009 at 6:40 am