Rate v0.2 is pretty good, doesn’t break

I have received a lot of feedback from the WordPress community about my ratings plugin, Rate. I squashed some bugs and added some features and can now take this thing out of what I like to call “Beta.” If this thing breaks when you install, I am now officially an asshole.

You still need to insert the_rating() and the_comment_rating() into your theme – see screenshots on the plugin page – but I wrote some filters using the Plugin API that will insert the ratings widget into the comment form, so you can rate a post/page/product/thing while commenting, instead of after commenting. I probably should have started with this functionality, but it took a while to figure out the best way to do it.

Even though comment_karma is a field in the $wpdb->comments table, the comment_karma field will not be saved with the other comment fields if that field is Post’d along with the other values, so I actually have run a second database query after the comment has been inserted to save the rating (comment_karma) along with the comment data.

Weird and annoying.

Anyways, this thing should work like a champ now. I also fixed the_rating() to display a more accurate average of the ratings. Instead of just doing SELECT AVG(comment_karma), I added this logic: WHERE comment_karma > 0. Once again, duh, but at least it’s fixed NOW.

New Plugin, “Rate”

Update: It broke! Update to 0.1.1 please!

Disclaimer #1: Beta Release, it might break

Disclaimer #2: I am not a maniac, the only reason I am writing so many plugins right now is because I have a lot of freelance projects, little time to fuck around, and a desire to save my solutions for future use

I am well-aware that there are 5 million Ratings plugins for WordPress, and (from what I can tell) most of them suck. The amount of bad inline JavaScript and disgusting HTML that most of them produce is just sad. Ratings are a little wee feature of a site, not a monstrous piece of architecture that need to jam itself into every corner of your  code base.

That’s why I wrote “Rate.” In sticking with my verb naming scheme see (Tumble and Shuffle), I have tried to make ratings as painless and clean as possible.

There are 2 functions that display ratings:




Your users rate your Page / Post / Product whatever in the comments section, and the average rating from all of the Page / Post / Whatever’s ratings is accessible with the_rating(). Rate makes use of the oft-overlooked and under-utilized comment_karma field in the wp_comments table.

The functions don’t install themselves automatically, you must insert them into your Theme in the appropriate places. The ratings styles are loaded by default from within the plugin directory. If you want to override with your own styles, drop a rate.css file in your theme’s directory and the rate plugin CSS won’t load, yours will!

I really thought I could download a plugin from the WordPress Plugin Directory that would suit my needs. I installed PollDaddy the minute I realized that it supported ratings. PollDaddy’s implementation is disgraceful and completely un-override-able. Aside from having inline event handlers (which is ghetto), the styles are written dynamically with JavaScript which makes them virtually impossible to override in CSS. The presentation options/settings are pretty limiting as well.

Hopefully Rate will grow and mature into the cleanest and best ratings plugin for WordPress.