Latest Register Log In

+ Advanced Search

Custom Rating Fields

Custom Rating Fields
By
09/25/03 (Edited 03/10/14)

For some purposes, just having a generic website rating isn't enough. You may wish to have several features of each topic rated. You can do this by adding custom rating fields.

A custom rating field can be added in the same way as any other new topic field (go to Admin Panel -> Topics -> Topic Fields in WSN 9.0+, or Admin Panel -> Customizations -> Add Fields in earlier versions), the only difference in the process being that you must give the template variable a name that includes 'rating' in it. For example, 'stylerating'. If you select rating field and don't include rating in the field name, it'll be appended automatically.

In the display html, you will need to make use of these separate topic template variables for your new rating field:

{LINKSTARS[fieldname]} - Graphically displays the current rating with stars and allows voting by clicking a star.
{LINKRATING[fieldname]} - Shows the rating, which is a decimal number normally between 1 and 5 (depending on your min and max vote value settings).
{LINKVOTES[fieldname]} - Shows the number of votes so far.

Using the example of a field stylerating, you will have {LINKSTARS[stylerating]}, {LINKRATING[stylerating]} and {LINKVOTES[stylerating]}.

In the vote template you'll probably want to use {LINKSTARS[stylerating <,> own]} instead to show only the current viewer's vote (indicating to them what their vote was, and allowing them to change it if applicable).

To make showing/editing of individual votes work for custom rating fields, pass &field=ratingfieldname at the end of the normal show votes url.

To do custom ratings for members, use memid={MEMBERID} in place of id={LINKID} in your form.

If using the rating posts switch:

Those of you including posts with ratings will probably will need to make some further modifications to the Admin -> Themes -> Manage Templates -> "Vote" template. To collect the vote in the rating submission form, use this:
<tr>
<td class="labelscolumn"><span class="labels">Rate {LINKTITLE}'s Style:</span></td>
<td class="optionscolumn"><select name="styleratingvotevalue"><option value=""></option>{RATINGVOTEOPS[stylerating]}</select></td>
</tr>

To display a person's full set of ratings plus their post in one spot. The toplist in the default "vote" template does this for you, but it doesn't include your custom rating fields. Then to display the vote above the post after submitted, find
<div class="ratingsstars">
{RATINGSTARS}
</div>
and change it to
<div class="ratingsstars">
Overall rating: {RATINGSTARS}
<br>Style rating: {RATINGSTARS[stylerating]}
</div>




Description Letting people vote on more specific details.
Rating
Views 2220 views. Averaging 0 views per day.