The rating plugin allow you to rate items (story, staticpage, comment…) and add review to items.
[file:54 Dowload Rating plugin]
Upgrade 2.2beta to 2.3.0
Upgrade 2.1beta to 2.2beta
Upgrade 1.0b2 or 2.0beta to 2.1beta
As this is a new plugin, and other plugin makers have not had time to allow their plugins to use the rating plugins functionality, at this point you have an installed rating plugin that can do absolutely nothing. You now need to modify your template files (See Templates below) to make Geeklog use the plugin.
Integration in other plugins is simple, and involves calling just one function that will return the HTML to incorporate into your page.
/* start rating code */ if (function_exists('RATING_display_rating')) { $template->set_var('rating', RATING_display_rating($A['id'], 'myplugin', $A['id'], 1, 5, CONST_FLAG_DEFAULT_RATING ) ); } /* end rating code */
The “function_exists” check is there to ensure that your site is not compromised should the rating plugin be uninstalled.
| 'rating' | your template variable to replave with the rating HTML. You can grab the output of the function RATING_return_form directly if you prefer of course. |
| $A['id'] | in this case, a unique identifier. You can set this to whatever unique id you like. Can be 'myplugin_' . $A['id'] |
| 'myplugin' | the type of item you are rating. The statistics page will use this to separate out types of items being rated. |
| $A['id'] | in this case, your item identifier. |
| 1 | minimum value for rating (usually 1) |
| 5 | maximum value for rating (usually 5, set this to 1 if using Diggs) |
| 0 | Function Flag, defines if the rating includes reviews and how it is displayed (see below for acceptable values). |
If you have any questions, drop a message in the forum on on the main Geeklog site. There is a rating plugin thread here: http://www.geeklog.net/forum/index.php/
You need to customise your themes. This simply requires that you add
{rating}
wherever you want to have a rating appear. The files you will probably want to edit are (within each theme directory):
You can automatically add a rating option to any story or staticpage etc. that supports autotags. The format is
[ rating : id min max function_flag ]
| id | is any random (unique) key to use to tag the autotag |
| min | minimum possible score |
| max | maximum possible score |
| function_flag | defines if the rating includes reviews and how it is displayed |
The problem with autotags is that there is no way to access story ids, so when looking at the statistics page, there is no way to link back to the original story/staticpage/etc.
We have over come this by allowing you to manually add the id of the item the rating is linked too in the admin page. If you have modified the core files you will not have to worry about this for those particular ratings.
The Function Flag is made up of multiple values added together.
| Value | Description | Geeklog Defined Constant |
|---|---|---|
| 0 | Default setting, allows backwards compatibility | CONST_FLAG_DEFAULT_RATING |
| 1 | Display Rating as stars | CONST_FLAG_RATING_AS_STARS |
| 2 | Display Rating as text | CONST_FLAG_RATING_AS_TEXT |
| 1024 | Display a Digg type rating | CONST_FLAG_RATING_AS_DIGG |
| 4 | Show existing user rating | CONST_FLAG_SHOW_TOTALS |
| 8 | Show Average or Diggs Text | CONST_FLAG_SHOW_LABEL |
| 16 | Show View Review Button (if any ratings/reviews exist) | CONST_FLAG_REVIEWS_VIEW |
| 32 | Show Add Review button | CONST_FLAG_REVIEWS_ADD |
| 64 | Rating is a view only (No Adding) | CONST_FLAG_RATING_VIEW |
| 128 | User Rating interface as text ([1] [2] [3] …) | CONST_FLAG_RATE_AS_TEXT |
| 256 | User Rating interface as stars | CONST_FLAG_RATE_AS_STARS |
| 512 | User Rating interface as a dropdown list and save button | CONST_FLAG_RATE_AS_COMBO |
Please see the docs that are accessable from the Admin Rating area for more information.
Please email or post feedback in the threads mentioned above. In particular, if you are a plugin developer and would like to enable your plugin to use the rating plugin functionality, please drop a line.
Euan McKay & Tom Homer
Version 2.3.1 Dec. 15th 2010
Version 2.3.0 July 16th 2007