Make Popularity Contest Work with WP-Super-Cache

User ImageThaya Kareeson
Popularity: 91%
Updated: Jun 18, 2008

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.

Rate this:
3.2 (1 person)

5 Responses to “Make Popularity Contest Work with WP-Super-Cache”

  1. no imageThaya Kareeson (Check me out!) (89 comments)

    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.

    Rate this:
    2.5

    [Reply]

  2. no imageJTPratt's Blogging Mistakes (Check me out!) (4 comments)

    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.

    Rate this:
    3.2 (1 person)

    [Reply]

  3. no imageThaya Kareeson (Check me out!) (89 comments)

    @JTPratt
    I might be able to do that. I will look into it. I’ll keep you posted.

    Rate this:
    2.5

    [Reply]

  4. Make WP-PostViews Work with WP-Super-Cache | OMNINOGGIN

    [...] 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 [...]

  5. no imageThaya Kareeson (Check me out!) (89 comments)

    @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! :)

    Rate this:
    3.5

    [Reply]


Leave a Reply