Computer Science Publication

Average: 3.3 (3 votes)

Fivestar has extensive CCK support, which makes it so that the user is presented with a widget to rate some node with the widget while editing a node. It does not necessary rate the current node, nor does it rate anything if no value is entered in the Node ID field when configuring the CCK field. The value is saved in the node (so when you edit it it is still there), but no vote is registered in VotingAPI without the Node ID field filled out.

An example of a situation where you might want to use the CCK fivestar field is creating a node type called ‘review’. This review type would let users rate some particular node, and accompany their rating with a review. This could be combined with a standard rating on the target node, so that some users could rate the target node using the simple method, or write a complete review to accompany their rating.

To configure a CCK field for rating a node while creating a new ‘review’ node:

1) Create a new node type called ‘review’ at Administer -> Content Management -> Content Types. Configure the type. Do NOT set any fivestar settings on the content type form! We don’t want users to actually be able to rate the reviews themselves!

2) Edit your new content type, then click on the “Add Field” tab while on the content type form. Add a field called ‘rating’ to your new type, make it of type Fivestar Rating with the Stars radio button.

3) Configure the rating widget to your liking. Most field have help text which explain their purpose. The Node ID field is the most important field on the page which determines exactly what node will receive the value of the rating. In a realy simple case, you could just enter the value 10 to always rate on the same node with nid = 10. Usually you’ll need to enter PHP code to dynamically select what node you want to rate.