Previously I wrote “Make Your WordPress 10X faster During Traffic Storms“, which is a post about automatically turning WP-[Super]-Cache on/off and automatically switching your WordPress theme to a lighter theme during heavy traffic. One of the main reasons that I had this setup was because I could not get statistics to work with WP-Super-Cache (i.e. my chCounter & Popularity Contest plugin is hosed).
After some tinkering, I was able to get chCounter and Popularity Contest to work with WP-Super-Cache. This involves using javascript to count instead of PHP. chCounter was a simple change, but Popularity Contest was a bit more challenging. Usually I would immediately post the “How-to” here, or rather release the modded plugin to the public myself, but I believe that I shouldn’t step on Alex King’s shoes (the original developer of Popularity Contest). I’ve sent the Popularity Contest code to Alex for code review. He’s been doing some of the same work, and hopefully he can incorporate some of my changes into the plugin and release it to the public soon.
If anybody would like to use my version of the Popularity Contest before Alex King releases it to the public, you may download the WordPress 2.3.3 and WordPress 2.5 compatible version here:
Download: Popularity Contest JS Mod for WordPress 2.3.3.
*Note*
- This method does not work with feed_views (since you can’t really inject javascript into XML feeds and get them to reliably execute), but this mod takes care of home_views, category_views, archive_views, and single_views (from what I understand: comments, pingbacks, trackbacks are always working).
- Plugin is tested only up until WordPress 2.3.3 (tested not working on WordPress 2.5, see below for version 2.5).
*Special WordPress 2.3.3 Install Instructions*
Intallation works the same way as the original Popularity Contest except that you will need to do ONE OF THE FOLLOWING:
1. Place a symbolic link from plugins/popularity-contest-js.php -> plugins/popularity-contest/popularity-contest-js.php
2. Move popularity-contest-js.php directly under your plugins/ directory
Download: Popularity Contest JS Mod for WordPress 2.5.
*Note*
- This method does not work with feed_views (since you can’t really inject javascript into XML feeds and get them to reliably execute), but this mod takes care of home_views, category_views, archive_views, and single_views (from what I understand: comments, pingbacks, trackbacks are always working).
- Plugin only works with WordPress 2.5 and is not backwards compatible with WordPress 2.3.3.
*Special WordPress 2.5 Install Instructions*
Intallation works the same way as the original Popularity Contest except that you will need to do ONE OF THE FOLLOWING:
1. Place a symbolic link from wp-content/popularity-contest-js.php -> plugins/popularity-contest/popularity-contest-js.php
2. Move popularity-contest-js.php directly under your wp-content/ directory
That should be all. I would really appreciate it if you can provide any feedback (security issues, better implementations, or other important thing that I’m totally not aware of). Also please feel free to post questions and keep me posted on how things are going with the plugin.



Just found out that this post is being Stumbled Upon courtesy of Donncha O Caoimh’s submission to stumbleupon.com! Thank you!
For those of you who end up trying out my modded Popularity Contest. Please please please log any bugs, questions, comments, and ideas on this comment thread.
Wow - could you do this exact same mod for Lester Chan’s PostViews? That’s pretty much the only reason I can’t use cache or supercache, because it screws up all the counts.
@JTPratt
I might be able to do that. I will look into it. I’ll keep you posted.
@JTPratt
Fresh out of the oven: Make WP-PostViews Work with WP-Super-Cache. Let me know how it works out for you. Please remember to write about it if you like it!
#1 Result for wp super cache popularity contest on Google
I’m currently running WP 2.5.1 and am planning to upgrade to WP 2.6. Have you tried your plugin in WP 2.6? Is it safe to upgrade using this version?
replied on July 24th, 2008 at 1:12 am
@Balaji Dutt
I’m planning to release my own version of Popularity Contest pretty soon, so you wouldn’t have to worry when WP goes to 2.7. Please stay tuned!
Thank you for visiting! I’m running WP 2.6 right now and the plugin seems to work fine.
@Thaya - that is great to hear! Please keep us posted on your fork of Popularity Contest - it’s a great plugin, but the lack of development on Alex’s side is a bit frustrating.
One last question - I have a Windows based environment I would like to install the plugin on and test with WP 2.6 before updating my site. Is that symbolic link vital for the plugin to work - because symlinks are possible in Windows, but can have unpredictable results.
replied on July 24th, 2008 at 9:42 am
@Balaji Dutt
Symbolic links are not required. You can just move popularity-contest-js.php to under your wp-content/ directory.
hello,
thanks for your work with this plugin. i desire install it. i have see, when i install your plugin my wordpress report me a new version of wp-postviews 1.31.
I have move your popularity-contest-js.php in my wp-content/ directory.
My questions is: Can i upgrade in automatic this plugin from plugin pannel in wordpress?
thanks for all and excuse me for my english.
replied on August 8th, 2008 at 9:55 am
@Lino
Thank you for visiting. Are yout talking about wp-postviews or popularity contest? With popularity contest, I don’t think you can use the “upgrade automatically” feature with this mod because the modifications will just get overwritten.
That being said, please stay tuned. I’m planning to release my own version of Popularity Contest soon with more features to chew on ;). You can subscribe to the RSS feed to stay posted.
hey Thaya,
Firstly, thanks for the add on BC. Secondly, I’ll like to know if your version of Popularity Contest works on WP 2.6. I read your comment that it worked fine for you but it didn’t seem to work for me so I’m thinking of the possibility of using your version. This is the one of the 2 plugins that fail to work on my blog, the other being SezWho.
Yan
replied on August 11th, 2008 at 5:36 pm
@Yan
Thank you for visiting. I’m using my own modded version of Popularity Contest (the one I packaged for WP 2.5). It works fine with WP 2.6 as long as you do not move your wp-content folder. SezWho did not fail on me either. Do you have the latest version installed?
replied on August 11th, 2008 at 6:00 pm
Yeah, for some weird reasons, I couldn’t get the the popup to work when you hover the ‘Check me out’. I believe I did install the latest one.
Anyway, I’ll give your version of PC a try and I’ll keep you updated.
Thanks. Thaya.
Yan
Nope, it doesn’t work for me either.
“Plugin could not be activated because it triggered a fatal error.”
Same old story…
Yan
replied on August 14th, 2008 at 2:27 pm
@Yan
That’s interesting. Let me email you to see what issues you are having. It’ll be easier to debug that way.
[...] plugin_version:”2.0″} ; In response to JPratt’s comment on my post, “Make Popularity Contest Work with WP-Super-Cache,” I am releasing a modification of Lester Chan’s WP-PostViews plugin to support [...]