Ajax Comments is a plugin for Movable Type 4 that enables your commenters to post comments using Ajax, without the page refreshing.

Live Demo

The best way to describe Ajax Comments is to show you. Try it out right now on the MT Test Blog. Click here to post a comment on the test entry.

Template Sets

To make Ajax Rating easy to setup, 6 templates are included. The following templates are new ones:

Ajax Comments Javascript (index template) - Contains links to the Javascript needed to posta comment.
YUI Javascript (template module) - Contains references to YUI Javascript libraries hosted externally.

...and 4 templates that are replacements for MT4 default templates: (Note: if you already customized these templates, you may have to do some manual template customization here. The installer will back up your existiing versions of these template.)

  • Comments (template module)
  • Comment Form (template module)
  • Comment Preview (system template)
  • Comment Response (system template)

The above templates can be easily installed by clicking the "install templates" button in the plugin settings (requires the Template Installer plugin).

Spam Protect

Ajax Comments can also be used to reduce your spam load significantly with "Spam Protect". Spam Protect is enabled by default, but you can disable it in the plugin settings. Spam Protect tricks automated spambots by tricking them into posting comments to the wrong URL. I have used this technique for a few years, and it makes a big difference is spam volume as server load. The one drawback to using Spam Protect is that commenters must have Javascript enabled to successfully post comments -- the tiny percentage of people who have Javascript disbaled will be sent to the "fake" Spam Protect URL. To minimize the CPU load from spambots, I recommend setting the Spam Protect URL to a non-existant page, so the bots will get a 404 "page not found" error.

Requirements

Installation

  • Download and extract the zip file. Upload the contents of the 'plugins' folder to the 'plugins' directory of your Movable Type installation.
  • Go the the plugin settings (Preferences > Plugins, then click Ajax Comments then Settings). Install the templates by clicking the button.
  • (Optional) Return to the plugin settings and adjust the Spam Protect settings and save.
  • Edit your "Header" template module. Go to Design > Templates then choose "Template Modules" from the right side of the page. Open the "Header" template. Look for a line that says:
    <MTIf name="feedback_template">

    After that line, add the following two lines:

    <$MTInclude module="YUI Javascript"$>
    <script type="text/javascript" src="<$MTLink template="ajax_comments_javascript"$>"></script>

  • Ensure that you have the "Use Comment Confirmation Page" setting checked under Preferences > Blog Settings > Comments. This is checked by default in new MT4 blogs. It must be checked for Ajax Comments to work.

  • Rebuild your Entry Archives.

Get Ajax Comments

Commercial License - $97.00

Personal License - Free

Ajax Comments is free for personal, non-commercial use.

Download Now

Download Now
Downloads: 1282

Membership required, please sign-in or register:

As always, comments and suggestions are welcome.

Ajax Rating is a plugin for Movable Type that enables visitors to rate your entries or your blog.

Try it now by rating this blog:

  • Currently 3.7/5
  • 1
  • 2
  • 3
  • 4
  • 5

The "Pro" version of Ajax Rating lets you rate comments, trackbacks, categories, authors, tags, and just about anything else. Added features include threshold viewing for comments based on rating, listing "hot" items, and comment reporting. More details on the Pro version below.

Ajax Rating is easy to setup and use. After downloading the plugin and installing the files, a few simple changes to your templates will enable you to adding Ajax Star Raters to your entries. For example, just add <MTAjaxStarRater type="entry"> to after the <MTEntryBody> tag and you are done - instant Ajax Star Ratings.

New in Version 1.11

Update 9/7/07 11:15 EDT: - Version 1.11 has been released, which fixes 2 bugs, one that affected new MT4 installs in which the tables didn't get added,. and the other affect the star rater under dynamic publishing. If you downloaded version 1.1 yesterday or earlier today, you should updgrade to v1.11 using the download link below.

Ajax Rating v1.11 adds full support for Movable Type 4 (including Ajax Rating Pro). Version 1.11 supports three major versions of MT: 3.2, 3.3x, and 4.0+. Apart from adding MT4 support, there are no new features in this version. Also note that the Templater Installer plugin is required when installing Ajax Rating on MT4.

Download Now

Download Now (Ajax Rating for Personal Use)
Downloads: 7764

Ajax Rating Pro

Ajax Rating Pro has a lot more features:

  • Thumbs up /down (or plus/minus) rating modes
  • Display listings of top rated items
  • Rate comments and other objects
  • Hide comments below a certain rating threshold
  • Enable visitors to choose their own threshold
  • Include a button for reporting spam or inappropriate comments
  • Display "hot lists" based on recent voting activity

Digg-like Functionality

The "hot lists" feature mentioned above is one of the most powerful features of Ajax Rating. It can be used to enable Digg-like functionality, in which your home page can be set to display only the items that are "popular now". Used this way, the ratings become a filter for the content you feature on the home page. If you have a site or blog network with new entries be added frequently, this feature is especially useful. In a typical blog-format home page, entries get pushed lower down the page every time a new one is posted, so even popular entries can get pushed off the home page quickly on a busy site. Ajax Ratings gives you an alternative to this, displaying the hottest entries first, as determined by visitor rankings. This is automatic, and you can define the "hot" time frame (1 day, 3 days, 2 weeks, etc.). Ajax Rating hot lists can really change the dynamics of a site, and may inspire ideas for new ratings-driven sites.

Comment Viewing Threshold

Sites like Slashdot, Scoop-powered sites, and Digg have a similar feature, which hides comments if they are below a certain rating or score threshold. Referred to as a comment viewing threshold or a "collaborative filtering tool", the idea is to display top-rated comments prominently, while hiding or collapsing lower rated comments. With the Ajax Rating plugin, it is possible to do this with Movable Type comments. The plugin is very flexible in how you want to set this, but a common approach might be to enable readers to vote each comment "up" or "down" (plus or minus, thumbs up, thumbs down, etc.). A vote up would equal +1 point and a vote down would equal -1 point. You then set a default viewing threshold. For example, you might choose -10 as the default, meaning that comments with a total score of less than -10 will appear collapsed (or partially or completely hidden, you choose). Collapsed comments can be displayed with a single click. You can also include a form that enables readers to set their own threshold level. Again, this is very customizable, you decide how you want things to work on your site. Take a look at this test entry, which demonstrates both a Star Rater (for the entry) and Plus/Minus comment threshold viewing (for the comments). Set your own threshold using the form at the bottom of the comments and see how the display changes. Similar to the hot list described, above comment viewing thresholds are another way to transform the display of your content based on user ratings.

Rate Anything

Another advanced feature is the ability to rate anything at all. In addition to rating MT objects like entries, comments, categories, authors, and blogs, you can also use Ajax Ratings to rate other things. For example, if you want to create a rater for a movie or book, you can do that. (Example: <$MTAjaxStarRater type="movie" id="23" max_points="5$> -- just remember what movie you assigned the ID 23 to....)

One Vote per IP Address

To prevent people from voting multiple times on the same item, only one vote is accepted per IP address per item.

Template Tags

Template tags for Ajax Rating are available for both static and dynamic (php) publishing.

The following template tags are available in Ajax Rating (free version):

  • <MTAjaxStarRater> - This tag will output a star rater like the one shown above. To rate entries, it must be used in an Entry context (ie. between <MTEntries> and </MTEntries> tags or in the Individual Archive Template. A good spot is just after the <MTEntryBody> tag. The following arguments are supported:
    • type - Recommend (but not required) when rating entries and required when rating a blog. (Example: <MTAjaxStarRater type="entry"> or <MTAjaxStarRater type="blog"). With Ajax Rating Pro, you can also specify the following types: comment, category, author, tag, trackback, or anything else (see "rate anything" above).
    • max_points - Not required for entries and comments, but required for other types. This argument specifies the number of stars that will be displayed. (Example: <MTAjaxStarRater type="blog" max_points="5"> will create a rater with 5 stars)
    • id - For advanced use, the id argument enables you specify a specific object ID number that you want to rate. If you use the tag in the correct context, you don't need to include the 'id' argument. But if you want to place a rater outside of the relevant context, or if you want to rate a non-MT object (see "rate anything" above), then you must specify the id of the object. Normally, you don't want to use this, so forget I mentioned it. ;)
  • <MTAjaxRatingTotalScore> - This will display the total score for the item being rated (adding up the values of all of the ratings made).
  • <MTAjaxRatingAverageScore> - This will display the average score for the item being rated.
  • <MTAjaxRatingVoteCount> - This will display the number of votes or ratings that have been submitted for this item.
  • <MTAjaxRatingEntryMax> - This will display the maximum number of points (stars) for rating entries, as specified in the plugin settings for that blog.

With Ajax Rating Pro, the following tags are also available (in addition to those described above):

  • <MTAjaxRatingList> - A general purpose container tag for displaying listings of "top rated" items in the MT database. The following arguments are available:
    • type - Required. Allowed values are: entry, comment, trackback, category, blog, author, tag. Tip: do not pluralize these types.
    • sort_by - Determines which metric is use to rank the results. Allowed value are: average, votes, total. The default is sorting by total score.
    • sort_order - The sort_order defaults to 'descend' (highest rating first), but you could also specify 'ascend' to show the worst rated items first.
    • blogs - To display a list of items from all blogs on the system, specify blogs="all". Otherwise, leave this out and the list will be restricted to the current blog.
    • show_n - Use this argument to specify the number of items you want to list (the default is 10). (Example: <MTAjaxRatingList type="entry" show_n="15">)
    • hot - Set 'hot' equal to 1 to generate a list of recently "hot" items (this is the powerful feature discussed above). When the 'hot' argument is set to 0 or omitted, the listing will be based on "all time" ratings data. Adding hot="1" will based the listing on recent voting activity only.
  • <MTAjaxRatingEntries> - Same as <MTAjaxRatingList type="entry">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingComments> - Same as <MTAjaxRatingList type="comment">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingPings> - Same as <MTAjaxRatingList type="trackback">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingCategories> - Same as <MTAjaxRatingList type="category">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingBlogs> - Same as <MTAjaxRatingList type="blog">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingAuthors> - Same as <MTAjaxRatingList type="author">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingTags> - Same as <MTAjaxRatingList type="tag">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxThumbRater> - Instead of a star rater, this tag will display a thumbs up/down (or plus/minus, etc.) rater. With this type of rater, there are images for voting an item "up" or "down". A vote "up" is equal to 1 point, a vote "down" is equal -1 point. The following arguments are available:
    • type - Recommend (but not required when used in an entry or comment context). (Example: <MTAjaxThumbRater type="comment">). The same types can be used as described for <MTAjaxStarRater> above.
    • id - Same (advanced) usage as described for <MTAjaxStarRater> above.
    • report_icon - This optional argument will display a third button, a "report" button, when used with comment raters. Visitors to your site can click this button to report the comment (for abuse, spam, profanity, etc.). When a comment is reported, an email is sent to the author of that entry, along with a link to edit the comment in question.
  • <MTAjaxRaterOnclickJS> - In addition to the convenient star and thumb raters, you can create your own rater. This tag makes it easier. To enable a rating button (or text link), you need to specify a javascript onclick event. This tag fills in the details. For example suppose you wanted to create a single voting text link for each entry - you could do so as follows: <a href="#" onclick="<$MTAjaxRaterOnclickJS type="entry" points="1"$>">I like it!</a>). Arguments include:
    • type - Recommended (but not required when used in an entry or comment context).
    • id - Same (advanced) usage as described for <MTAjaxStarRater> above.
  • <MTAjaxRatingCommentMax> - This will display the maximum number of points for rating comments, as specified in the plugin settings for that blog.
  • <MTAjaxRatingDefaultThreshold> - This will display the default threshold for viewing comments, as specified in the plugin settings for that blog.
  • <MTIfAjaxRatingBelowThreshold> - This is conditional tag whose contents will be displayed if the comment is below the default threshold, as specified in the settings. Note that this tag does not apply to user-specified thresholds (more on those later).
  • <MTAjaxRatingRefreshHot> - WARNING: You should not use this tag if you have a busy site with high-volume voting activity. This a special tag, it displays no ouput. It simply triggers the process of calculating the list of "hot" items. Note that "hot" list are not tabulated when the listing tags are rebuilt. For performance reasons, this process happens separately, usually via an MT scheduled task that runs automatically (approx) once every hour. If, for some reason, you want to manually refresh to the "hot" list, you can place the <MTAjaxRatingRefreshHot> tag into an index template and rebuild it (be sure to uncheck the "rebuild this template with indexes" box!). Again, this should be used carefully on busy sites, and usually not at all. The "hot" list can also be refreshed via an included cron script (more on this later).
Ajax Rating Settings

The settings for Ajax Ratings looks like this:

The blog settings for Ajax rating Pro looks like this:

Ajax Rating Pro also has a setting that is set only at the system level (Go to System Overview > Plugins). The system setting looks like this:

One of the notable settings is the "Rebuild After a Vote" option. High traffic site with high-volume voting should be careful with this setting. Generally speaking rebuilds can consume a lot of processor cycles, and a significant rebuilding after votes could slow things down, depending on several factors. The best performance option is "No Rebuilds" -- if you choose this option, the page will get update with the reader's vote immediately, but if this refresh the page, their vote won't be reflected (because the page has not yet been rebuilt). In this mode, ratings and votes counts get recorded into the database, but are not reflected on your pages until those pages are rebuilt (such as after a comment is posted to the entry, or manually rebuilt). If you have a site with high volume voting, chances are that you also have high-volume commenting -- if this is true, use the "No Rebuilds" option here and your entries will still be rebuilt every time a comment is posted. The second option here is "Rebuild Entry Only" -- this will only rebuild the Individual Archive template(s) for that entry (or if the vote is for a category, it will only rebuild the relevant category archive page) -- performance-wise, this option is not too bad. The third option is "Rebuild Entry, Archives, Indexes" -- this is the same level of rebuilding that happens when a comment is posted. It is the worst option performance-wise, as many pages may be rebuilt (the individual archive page(s), each of the category pages for the entries categories, any date-based archives enabled, and every index template in your blog. Be careful with this one on high-traffic blogs. The final option is "Build Indexes Only", which will only rebuild your index templates. This option might be suitable if you are only using the "Rate This Blog" widget (more on this later) on your main index. Note that if you are using PHP Dynamic publishing, there is no issue with rebuilds, you can set this to "No Rebuilds" and ratings will always be reflected correctly each time the page is loaded.

Requirements

(Note: If you are running 3.3x or 4.0, installation will be much easier, as the database tables will be automatically created for you. If you are running 3.2, you will need to create the tables manually - or via a utility like phpMyAdmin)

Installation Instructions

  1. Expand the zip file.
  2. Upload the contents of the 'plugins' directory to the 'plugins' directory of your MT install (usually /cgi-bin/mt/plugins)
  3. Upload the contents of the 'mt-static' directory to the static directory created when you installed MT (usually called 'mt-static')
  4. Change the permissions on the mt-vote.cgi and mt-report.cgi (Pro only) files found within /plugins/AjaxRating/ to 755 (CHMOD 755)
  5. Login to Movable Type (or if already logged, click "Main Menu")
  6. If your are running MT 3.3x or 4.0, you should now be redirected to an Upgrade screen that will install the tables for Ajax Rating. If you are running MT 3.2, then you need to create the tables manually, using the ajaxrating.sql file to create these tables.
  7. After the tables have been created, browse to the settings (Preferences>Plugins for MT4 or Settings->Plugins for older versions) for the blog you want. Choose the settings that you want and then save.
  8. Return to the settings and click the "Install Templates" link. This will install the javascript and styles index templates and rebuild them automatically. (Note: if you change you settings in future, remember to manually rebuild this index templates afterwards)
  9. For every template for which you plan to place raters, add the following between the <head> and </head> tags (if you are using the MT4 default templates, go to Template Modules and edit the "Header" template):
  10. <script type="text/javascript" src="<MTStaticWebPath>prototype.lite.js"></script>
    <script type="text/javascript" src="<MTStaticWebPath>moo.ajax.js"></script>
    <script type="text/javascript" src="<MTBlogURL>ajaxrating.js"></script>
    <link rel="stylesheet" href="<$MTBlogURL$>ajaxrating.css" type="text/css" />

  11. Now you can place raters to meet your needs. Most people may want to add something like the following below the <MTEntryBody> tag (if you are using the MT4 default templates, go to Template Modules and edit the "Entry Summary" and "Entry Detail" templates):
  12. <$MTAjaxStarRater type="entry"$>
    Rating: <strong><span id="ajaxrating_entry_<$MTEntryID$>_avg"><$MTAjaxRatingAverageScore type="entry"$></span></strong>/<$MTAjaxRatingEntryMax$> (<span id="ajaxrating_entry_<$MTEntryID$>_cnt"><$MTAjaxRatingVoteCount type="entry"$></span> votes cast)

  13. Add the included Ajax Rating widget to your sidebar. This will display a "Rate this Blog" section that will enable people to rate your blog. (Optional)

  14. Test it out and tell people they can start submitting votes!

For more advanced usage, see the articles linked at the bottom of this entry.

Get Ajax Rating

Ajax Rating is free for personal use, but you must include a link on your home page to http://mt-hacks.com/ajaxrating.html, such as:

Ratings on this site are powered by the <a href="http://mt-hacks.com/ajaxrating.html">Ajax Rating</a> plugin for Movable Type.

Download Now

Download Now (Ajax Rating for Personal Use)
Downloads: 7764

A lot of effort went into this plugin, donations are much appreciated. Suggested donation is $10:

If you wish to use Ajax Rating for commercial use, a commercial license must be purchased for $25:

Get Ajax Rating Pro

Ajax Rating Pro Regular License (1 to 10 blogs)

A regular license for Ajax Rating Pro enable you to use Ajax Rating Pro on up to 10 blogs on a single MT installation. The cost is $249:

Ajax Rating Pro Blog Network License (10+ blogs)

If you want to use Ajax Rating Pro on more than 10 blogs on a single MT installation, you can purchase a "Blog Network License". The blog network license is for unlimited blogs on the same install, and includes up to 2 hours of implementation consulting and a custom multi-blog installation script. The multi-blog installation script can be customized to meet your needs (subject to the 2 hours of consulting time) and includes setup of settings and installation of templates for each blog. The blog network license is $499.

Rater Images and CSS Styles

I did not design the default star graphic used with this plugin, and I did not craft the CSS styles that make it look and work so slick. Much credit for both of these elements goes to Ryan Masuga of Masuga Design. Ryan's Unobtrusive AJAX Star Rating Bar has been downloaded more than 85,000 times! Thank you Ryan.

The plus / minus images, on the other hand, I did design .... and it shows. Graphic design is not my forte. As mentioned above, you can swap out your own images for both types of raters (more on that soon). If anyone out there want to design some better button images, please do! Thumbs up and thumbs down images would be cool, and maybe a better plus/minus set as well. If you design some buttons you want to share, let me know I will post them here or include them with Ajax Rating (giving you credit of course).

Future Features

In the future Ajax Rating Pro will be enhanced even further. If you purchase a license for Ajax Rating Pro, you can help steer the development of new features. I see a lot of potential for this plugin with very active blog sites, and blog networks in particular -- and new features will likely be in this area. Here are a few ideas that may be worth adding if customers are interested:

  • more sophisticated "hot" list algorithms - making this more sophisticated and customizable, so you can fine tune everything to make sure that the popularity filter is promoting those items that help build community and create buzz
  • score summary for authors and commenters - look at which authors have the highest and lowesst rated entries (maybe offer prizes or compensation based on ratings), also look at summarized raters for each commenter, possibly triggering automatic or manual review when commenters have continually poor ratings (troll meter)
  • displaying rating and vote information on the MT admin screens
  • notification thresholds that will flag comments below thresholds, or even rules that automatically unpublish them pending review.

As always, comments, feedback, suggestions are welcome. Please reply to this entry.

The Ajax Rating Pro plugin enables you to setup comment threshold viewing for Movable Type powered sites. For more information about Ajax Rating Pro, click here.

This article focuses on ways that you can use Ajax Rating Pro to setup comment thresholds for Movable Type. The concept behind comment threshold is the ability to hide or collapse comments with rating score below a certain threshold. The result is collaborative filter, readers rate each others comments, and higher ranked comments are given more prominence, while lower ranked comments are given less prominence. Popular site such as Slashdot, Digg, and Scoop-powered sites use comment threshold filtering. It is a great tool for popular sites that attract a large number of comments.

Ajax Rating Pro is very flexible and customizable -- you can decide how you want to implement comment threshold filtering. Do you want to completely hide low ranked comments? Merely collapse them? Implement a default threshold score, or let readers choose their own? Something else in mind?

Ajax Rating Pro comes with a few built-in tools to help setup some of the more common approaches to comment thresholds. Let's walk through such an example. First take a look at the test entry here. Feel free to rate some comments and set a person comment threshold - notice how the display changes (refresh the page if needed). I am going go step-by-step to setup comment thresholds in this manner.

In this scenario, reader will rate comment with a vote up or a vote down. Votes are +1 point and votes down are -1 point. The default threshold is -3. In this scenario, comments with a total score of less than -3 will appear in a collapsed state. A single-click reveals the below threshold comment. Reader can optionally choose their own threshold using the form at the bottom of the comment listing.

Step 1 - After you have installed Ajax Rating Pro, go to the plugin settings for the blog you want. Choose Thumbs Up/Down for comment mode and choose 1 for Comment Max Points. Set the default threshold as desired (in this example, we will use -3).

Step 2 - Add a thumb rater to your Individual Archive template, between the <MTComments> and </MTComments> tags. In this example, I added it after the comment date on the default MT 3.3+ template:

<$MTAjaxThumbRater type="comment" report_icon="1"$> Score: <strong><span id="ajaxrating_comment_<MTCommentID>_ttl"><MTAjaxRating></span></strong> (<span id="ajaxrating_comment_<MTCommentID>_cnt"><MTAjaxRating show="vote_count"></span> votes cast)

Then rebuild your individual archives. (Tip: make sure you have the Ajax Rating lines in the <head> section of this template, as described in step 10 here. After rebuilding, each comment should have a thumb rater -- test to make sure the ratings are working.

Step 3 - Now that our readers can rate others' comments, now we can change the display for comments that fall below the threshold. In this example, we will do this using CSS styles to show or hide things. First we want to create add a section to the Individual Archive template, that will display only when comments fall below the threshold. In this example, immediately after </MTCommentsHeader>, enter the following:

<span class="below-threshold" id="threshold-<$MTCommentID$>">
<a href="#" id="c<$MTCommentID pad="1"$>" onclick="showComment(<$MTCommentID$>); return(false);"><$MTCommentBody trim_to="30" strip_linefeeds="1" remove_html="1"$>...</a> (Below threshold)
<p class="comment-footer">
Posted by <$MTCommentAuthorLink default_name="Anonymous"$> <$MTCommentAuthorIdentity$> |
<a href="#comment-<$MTCommentID$>"><$MTCommentDate$></a> | Score: <strong><$MTAjaxRatingTotalScore$></strong>
</p>
</span>

The first and last lines above are very important. This <span> encloses the stuff that we want to display when a comment is below the threshold. We will show and hide this span depending on the score and threshold. Both the class="below-threshold" and id="threshold-<$MTCommentID$>" are required for this purpose.

Inside the the span, you can customize what you want to display when a comment is below threshold. In this example, we have included a link that will display the comment. Notice the onclick argument in the link:

onclick="showComment(<$MTCommentID$>); return(false);"

This onclick section is important, as it will cause the link to run some javascript to display the comment in the browser.

Step 4 - The next step is to include a form that readers can use to set their own threshold. (If you don't want readers to be able to set their own threshold, you can skip this step). Below the </MTComments> tag, enter the following form code:

<form id="threshold-form" name="threshold_form" action="<$MTEntryLink$>#comments" onsubmit="setThreshold(this);">
<input type="text" name="threshold" size="3">
<input type="submit" name="submit" value="Set Comment Score Threshold">
</form>

The important part of this form is the onsubmit="setThreshold(this);" section as this will set the readers threshold by storing in a cookie in their browser.

Step 5 - By default, the section that we added in Step 3 above is hidden from view, and the full comment is displayed. At this point we need to compare the score to the threshold of each comment and decide which comments should be collapsed. Add the following below the form coded added in Step 4:

<script type="text/javascript">
<!--
var comments = new Array(<MTComments>'<$MTCommentID$>',</MTComments>'');
hideComments(comments);
//-->
</script>

The above javascript will check each of the comments. If a comment is below the threshold, the comment will be hidden and the section from Step 3 above will be displayed instead.

Step 6 - Rebuild your individual archives and test it!

The customized individual archive template used in this example on the test entry can be found here.

The above example is only one way to implement comment thresholds on your site using Ajax Rating Pro. You can customize the above to meet your needs. You can even edit the javascript and CSS elements to customize things further.

Another Built-in tool is the <MTIfAjaxRatingBelowThreshold> conditional tag. You can use this tag inside an <MTComments> container. Anything between <MTIfAjaxRatingBelowThreshold> and </MTIfAjaxRatingBelowThreshold> tags will not be inlcuded in the HTML of the page. (Note that the score is checked against the default threshold when the page is rebuilt, or if you are using PHP dynamic publishing, when the page is displayed). For example, if you wanted to completely hide comments below the default threshold, you could do something like this:

<MTComments>
<MTIfAjaxRatingBelowThreshold>

.....comment template code here......

</MTIfAjaxRatingBelowThreshold>
</MTComments>

Note that if you use this tag, you won't be able to provide a link to display the comment like in the example above.

Another way to use this tag might be to apply certain filters to comments below the default threshold. For example you might want to remove HTML from comments below threshold:

<MTIfAjaxRatingBelowThreshold>
<MTCommentBody remove_html="1">
<MTElse>
<MTCommentBody>
</MTIfAjaxRatingBelowThreshold>


I hope that the example above provide a few examples of how you can implement comment threshold viewing, and perhaps inspire a few ideas for unique ways to do so.

To get Ajax Rating Pro, or for more information, click here.

Update 2/11/2007: Also see these new articles on Ajax Rating:

Ajax Rating is a plugin for Movable Type that enables visitors to rate your entries or your blog.

Try it now by rating this blog:

  • Currently 3.7/5
  • 1
  • 2
  • 3
  • 4
  • 5

The "Pro" version of Ajax Rating lets you rate comments, trackbacks, categories, authors, tags, and just about anything else. Added features include threshold viewing for comments based on rating, listing "hot" items, and comment reporting. More details on the Pro version below.

Ajax Rating is easy to setup and use. After downloading the plugin and installing the files, a few simple changes to your templates will enable you to adding Ajax Star Raters to your entries. For example, just add <MTAjaxStarRater type="entry"> to after the <MTEntryBody> tag and you are done - instant Ajax Star Ratings.

Download Now

Download Now (Ajax Rating for Personal Use)
Downloads: 7764

Membership required, please sign-in or register:

Ajax Rating Pro

Ajax Rating Pro has a lot more features:

  • Thumbs up /down (or plus/minus) rating modes
  • Display listings of top rated items
  • Rate comments and other objects
  • Hide comments below a certain rating threshold
  • Enable visitors to choose their own threshold
  • Include a button for reporting spam or inappropriate comments
  • Display "hot lists" based on recent voting activity

Digg-like Functionality

The "hot lists" feature mentioned above is one of the most powerful features of Ajax Rating. It can be used to enable Digg-like functionality, in which your home page can be set to display only the items that are "popular now". Used this way, the ratings become a filter for the content you feature on the home page. If you have a site or blog network with new entries be added frequently, this feature is especially useful. In a typical blog-format home page, entries get pushed lower down the page every time a new one is posted, so even popular entries can get pushed off the home page quickly on a busy site. Ajax Ratings gives you an alternative to this, displaying the hottest entries first, as determined by visitor rankings. This is automatic, and you can define the "hot" time frame (1 day, 3 days, 2 weeks, etc.). Ajax Rating hot lists can really change the dynamics of a site, and may inspire ideas for new ratings-driven sites.

Comment Viewing Threshold

Sites like Slashdot, Scoop-powered sites, and Digg have a similar feature, which hides comments if they are below a certain rating or score threshold. Referred to as a comment viewing threshold or a "collaborative filtering tool", the idea is to display top-rated comments prominently, while hiding or collapsing lower rated comments. With the Ajax Rating plugin, it is possible to do this with Movable Type comments. The plugin is very flexible in how you want to set this, but a common approach might be to enable readers to vote each comment "up" or "down" (plus or minus, thumbs up, thumbs down, etc.). A vote up would equal +1 point and a vote down would equal -1 point. You then set a default viewing threshold. For example, you might choose -10 as the default, meaning that comments with a total score of less than -10 will appear collapsed (or partially or completely hidden, you choose). Collapsed comments can be displayed with a single click. You can also include a form that enables readers to set their own threshold level. Again, this is very customizable, you decide how you want things to work on your site. Take a look at this test entry, which demonstrates both a Star Rater (for the entry) and Plus/Minus comment threshold viewing (for the comments). Set your own threshold using the form at the bottom of the comments and see how the display changes. Similar to the hot list described, above comment viewing thresholds are another way to transform the display of your content based on user ratings.

Rate Anything

Another advanced feature is the ability to rate anything at all. In addition to rating MT objects like entries, comments, categories, authors, and blogs, you can also use Ajax Ratings to rate other things. For example, if you want to create a rater for a movie or book, you can do that. (Example: <$MTAjaxStarRater type="movie" id="23" max_points="5$> -- just remember what movie you assigned the ID 23 to....)

One Vote per IP Address

To prevent people from voting multiple times on the same item, only one vote is accepted per IP address per item.

Template Tags

Template tags for Ajax Rating are available for both static and dynamic (php) publishing.

The following template tags are available in Ajax Rating (free version):

  • <MTAjaxStarRater> - This tag will output a star rater like the one shown above. To rate entries, it must be used in an Entry context (ie. between <MTEntries> and </MTEntries> tags or in the Individual Archive Template. A good spot is just after the <MTEntryBody> tag. The following arguments are supported:
    • type - Recommend (but not required) when rating entries and required when rating a blog. (Example: <MTAjaxStarRater type="entry"> or <MTAjaxStarRater type="blog"). With Ajax Rating Pro, you can also specify the following types: comment, category, author, tag, trackback, or anything else (see "rate anything" above).
    • max_points - Not required for entries and comments, but required for other types. This argument specifies the number of stars that will be displayed. (Example: <MTAjaxStarRater type="blog" max_points="5"> will create a rater with 5 stars)
    • id - For advanced use, the id argument enables you specify a specific object ID number that you want to rate. If you use the tag in the correct context, you don't need to include the 'id' argument. But if you want to place a rater outside of the relevant context, or if you want to rate a non-MT object (see "rate anything" above), then you must specify the id of the object. Normally, you don't want to use this, so forget I mentioned it. ;)
  • <MTAjaxRatingTotalScore> - This will display the total score for the item being rated (adding up the values of all of the ratings made).
  • <MTAjaxRatingAverageScore> - This will display the average score for the item being rated.
  • <MTAjaxRatingVoteCount> - This will display the number of votes or ratings that have been submitted for this item.
  • <MTAjaxRatingEntryMax> - This will display the maximum number of points (stars) for rating entries, as specified in the plugin settings for that blog.

With Ajax Rating Pro, the following tags are also available (in addition to those described above):

  • <MTAjaxRatingList> - A general purpose container tag for displaying listings of "top rated" items in the MT database. The following arguments are available:
    • type - Required. Allowed values are: entry, comment, trackback, category, blog, author, tag. Tip: do not pluralize these types.
    • sort_by - Determines which metric is use to rank the results. Allowed value are: average, votes, total. The default is sorting by total score.
    • sort_order - The sort_order defaults to 'descend' (highest rating first), but you could also specify 'ascend' to show the worst rated items first.
    • blogs - To display a list of items from all blogs on the system, specify blogs="all". Otherwise, leave this out and the list will be restricted to the current blog.
    • show_n - Use this argument to specify the number of items you want to list (the default is 10). (Example: <MTAjaxRatingList type="entry" show_n="15">)
    • hot - Set 'hot' equal to 1 to generate a list of recently "hot" items (this is the powerful feature discussed above). When the 'hot' argument is set to 0 or omitted, the listing will be based on "all time" ratings data. Adding hot="1" will based the listing on recent voting activity only.
  • <MTAjaxRatingEntries> - Same as <MTAjaxRatingList type="entry">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingComments> - Same as <MTAjaxRatingList type="comment">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingPings> - Same as <MTAjaxRatingList type="trackback">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingCategories> - Same as <MTAjaxRatingList type="category">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingBlogs> - Same as <MTAjaxRatingList type="blog">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingAuthors> - Same as <MTAjaxRatingList type="author">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxRatingTags> - Same as <MTAjaxRatingList type="tag">. Same arguments as MTAjaxRatingList, but the 'type' argument is not required.
  • <MTAjaxThumbRater> - Instead of a star rater, this tag will display a thumbs up/down (or plus/minus, etc.) rater. With this type of rater, there are images for voting an item "up" or "down". A vote "up" is equal to 1 point, a vote "down" is equal -1 point. The following arguments are available:
    • type - Recommend (but not required when used in an entry or comment context). (Example: <MTAjaxThumbRater type="comment">). The same types can be used as described for <MTAjaxStarRater> above.
    • id - Same (advanced) usage as described for <MTAjaxStarRater> above.
    • report_icon - This optional argument will display a third button, a "report" button, when used with comment raters. Visitors to your site can click this button to report the comment (for abuse, spam, profanity, etc.). When a comment is reported, an email is sent to the author of that entry, along with a link to edit the comment in question.
  • <MTAjaxRaterOnclickJS> - In addition to the convenient star and thumb raters, you can create your own rater. This tag makes it easier. To enable a rating button (or text link), you need to specify a javascript onclick event. This tag fills in the details. For example suppose you wanted to create a single voting text link for each entry - you could do so as follows: <a href="#" onclick="<$MTAjaxRaterOnclickJS type="entry" points="1"$>">I like it!</a>). Arguments include:
    • type - Recommended (but not required when used in an entry or comment context).
    • id - Same (advanced) usage as described for <MTAjaxStarRater> above.
  • <MTAjaxRatingCommentMax> - This will display the maximum number of points for rating comments, as specified in the plugin settings for that blog.
  • <MTAjaxRatingDefaultThreshold> - This will display the default threshold for viewing comments, as specified in the plugin settings for that blog.
  • <MTIfAjaxRatingBelowThreshold> - This is conditional tag whose contents will be displayed if the comment is below the default threshold, as specified in the settings. Note that this tag does not apply to user-specified thresholds (more on those later).
  • <MTAjaxRatingRefreshHot> - WARNING: You should not use this tag if you have a busy site with high-volume voting activity. This a special tag, it displays no ouput. It simply triggers the process of calculating the list of "hot" items. Note that "hot" list are not tabulated when the listing tags are rebuilt. For performance reasons, this process happens separately, usually via an MT scheduled task that runs automatically (approx) once every hour. If, for some reason, you want to manually refresh to the "hot" list, you can place the <MTAjaxRatingRefreshHot> tag into an index template and rebuild it (be sure to uncheck the "rebuild this template with indexes" box!). Again, this should be used carefully on busy sites, and usually not at all. The "hot" list can also be refreshed via an included cron script (more on this later).
Ajax Rating Settings

The settings for Ajax Ratings looks like this:

The blog settings for Ajax rating Pro looks like this:

Ajax Rating Pro also has a setting that is set only at the system level (Go to System Overview > Plugins). The system setting looks like this:

One of the notable settings is the "Rebuild After a Vote" option. High traffic site with high-volume voting should be careful with this setting. Generally speaking rebuilds can consume a lot of processor cycles, and a significant rebuilding after votes could slow things down, depending on several factors. The best performance option is "No Rebuilds" -- if you choose this option, the page will get update with the reader's vote immediately, but if this refresh the page, their vote won't be reflected (because the page has not yet been rebuilt). In this mode, ratings and votes counts get recorded into the database, but are not reflected on your pages until those pages are rebuilt (such as after a comment is posted to the entry, or manually rebuilt). If you have a site with high volume voting, chances are that you also have high-volume commenting -- if this is true, use the "No Rebuilds" option here and your entries will still be rebuilt every time a comment is posted. The second option here is "Rebuild Entry Only" -- this will only rebuild the Individual Archive template(s) for that entry (or if the vote is for a category, it will only rebuild the relevant category archive page) -- performance-wise, this option is not too bad. The third option is "Rebuild Entry, Archives, Indexes" -- this is the same level of rebuilding that happens when a comment is posted. It is the worst option performance-wise, as many pages may be rebuilt (the individual archive page(s), each of the category pages for the entries categories, any date-based archives enabled, and every index template in your blog. Be careful with this one on high-traffic blogs. The final option is "Build Indexes Only", which will only rebuild your index templates. This option might be suitable if you are only using the "Rate This Blog" widget (more on this later) on your main index. Note that if you are using PHP Dynamic publishing, there is no issue with rebuilds, you can set this to "No Rebuilds" and ratings will always be reflected correctly each time the page is loaded.

Requirements

MT 3.2+

(Note: If you are running 3.3+, installation will be much easier, as the database tables will be automatically created for you. If you are running 3.2, you will need to create the tables manually - or via a utility like phpMyAdmin)

Installation Instructions

  1. Expand the zip file.
  2. Upload the contents of the 'plugins' directory to the 'plugins' directory of your MT install (usually /cgi-bin/mt/plugins)
  3. Upload the contents of the 'php' directory to the 'php' directory of your MT install (usually /cgi-bin/mt/php)
  4. Upload the contents of the 'mt-static' directory to the static directory created when you installed MT (usually called 'mt-static')
  5. Change the permissions on the mt-vote.cgi and mt-report.cgi (Pro only) files found within /plugins/AjaxRating/ to 755 (CHMOD 755)
  6. Login to Movable Type (or if already logged, click "Main Menu")
  7. If your are running MT 3.3+, you should now be redirected to an Upgrade screen that will install the tables for Ajax Rating. If you are running MT 3.2, then you need to create the tables manually, using the ajaxrating.sql file to create these tables.
  8. After the tables have been created, browse to the settings (Settings->Plugins) for the blog you want. Choose the settings that you want and then save.
  9. Return to the settings and click the "Click here to install the Ajax Rating templates for this blog" link. This will install the javascript and styles index templates and rebuild them automatically. (Note: if you change you settings in future, remember to manually rebuild this index templates afterwards)
  10. For every template for which you plan to place raters, add the following between the <head> and </head> tags:
  11. <script type="text/javascript" src="<MTStaticWebPath>prototype.lite.js"></script>
    <script type="text/javascript" src="<MTStaticWebPath>moo.ajax.js"></script>
    <script type="text/javascript" src="<MTBlogURL>ajaxrating.js"></script>
    <link rel="stylesheet" href="<$MTBlogURL$>ajaxrating.css" type="text/css" />

  12. Now you can place raters to meet your needs. Most people may want to add something like the following below the <MTEntryBody> tag:
  13. <$MTAjaxStarRater type="entry"$>
    Rating: <strong><span id="ajaxrating_entry_<$MTEntryID$>_avg"><$MTAjaxRatingAverageScore type="entry"$></span></strong>/<$MTAjaxRatingEntryMax$> (<span id="ajaxrating_entry_<$MTEntryID$>_cnt"><$MTAjaxRatingVoteCount type="entry"$></span> votes cast)

  14. Add the included Ajax Rating widget to your sidebar. This will display a "Rate this Blog" section that will enable people to rate your blog. (Optional)

  15. Test it out and tell people they can start submitting votes!

For more advanced usage, I am going to post a separate article soon, covering topics such as custom raters, comment threshold setup, customizing the star and plus/minus buttons, and more.

Get Ajax Rating

Ajax Rating is free for personal use, but you must include a link on your home page to http://mt-hacks.com/ajaxrating.html, such as:

Ratings on this site are powered by the <a href="http://mt-hacks.com/ajaxrating.html">Ajax Rating</a> plugin for Movable Type.

Download Now

Download Now (Ajax Rating for Personal Use)
Downloads: 7764

Membership required, please sign-in or register:

A lot of effort went into this plugin, donations are much appreciated. Suggested donation is $10:

If you wish to use Ajax Rating for commercial use, a commercial license must be purchased for $25:

Get Ajax Rating Pro

Ajax Rating Pro Regular License (1 to 10 blogs)

A regular license for Ajax Rating Pro enable you to use Ajax Rating Pro on up to 10 blogs on a single MT installation. The cost is $249:

Ajax Rating Pro Blog Network License (10+ blogs)

If you want to use Ajax Rating Pro on more than 10 blogs on a single MT installation, you can purchase a "Blog Network License". The blog network license is for unlimited blogs on the same install, and includes up to 2 hours of implementation consulting and a custom multi-blog installation script. The multi-blog installation script can be customized to meet your needs (subject to the 2 hours of consulting time) and includes setup of settings and installation of templates for each blog. The blog network license is $499.

Rater Images and CSS Styles

I did not design the default star graphic used with this plugin, and I did not craft the CSS styles that make it look and work so slick. Much credit for both of these elements goes to Ryan Masuga of Masuga Design. Ryan's Unobtrusive AJAX Star Rating Bar has been downloaded more than 12,000 times! Thank you Ryan.

The plus / minus images, on the other hand, I did design .... and it shows. Graphic design is not my forte. As mentioned above, you can swap out your own images for both types of raters (more on that soon). If anyone out there want to design some better button images, please do! Thumbs up and thumbs down images would be cool, and maybe a better plus/minus set as well. If you design some buttons you want to share, let me know I will post them here or include them with Ajax Rating (giving you credit of course).

Future Features

In the future Ajax Rating Pro will be enhanced even further. If you purchase a license for Ajax Rating Pro, you can help steer the development of new features. I see a lot of potential for this plugin with very active blog sites, and blog networks in particular -- and new features will likely be in this area. Here are a few ideas that may be worth adding if customers are interested:

  • more sophisticated "hot" list algorithms - making this more sophisticated and customizable, so you can fine tune everything to make sure that the popularity filter is promoting those items that help build community and create buzz
  • score summary for authors and commenters - look at which authors have the highest and lowesst rated entries (maybe offer prizes or compensation based on ratings), also look at summarized raters for each commenter, possibly triggering automatic or manual review when commenters have continually poor ratings (troll meter)
  • displaying rating and vote information on the MT admin screens
  • notification thresholds that will flag comments below thresholds, or even rules that automatically unpublish them pending review.

As always, comments, feedback, suggestions are welcome. Please reply to this entry.

Update 2/11/2007: Also see these new articles on Ajax Rating: