Creating a User Comment/Rating and Average Rating for a Content type

Last updated on
13 May 2020

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Setting Up the Content Type (node-type)

  1. Go to the admin/config/content/fivestar
  2. Create a new Tag called "Rating" (e.g. vote, Rating).
  3. Go to your content type.
  4. Add a new Fivestar Field, called "Rating".
  5. Select Widget type: Stars (rated while viewing).
  6. Save Field.
  7. Select Tag: Rating.
  8. Save field Settings
  9. Select 'Number of stars' (Make sure it will be the same on both the content type and the comments
  10. Be sure to check "Allow users to vote on their own content" otherwise you won't be able to test it working on your own content
  11. Make any other customizations
  12. Save Settings
  13. Go to your content type's display settings.
  14. Click the settings button (gear icon on the right side) for the "Rating" field.
  15. Make sure Value to display as stars is set to 'Average Vote'
  16. Make any other customizations.
  17. Click 'update'
  18. Save your content type

Setting Up the Comments/Ratings

Voting Target

  1. Go to the comment field settings for the content type we just added our field to.
  2. Use 'Add existing field' and add the same 'Rating' field you used on the content type.
  3. Widget: "Stars (rated while editing)".
  4. Save Field.
  5. Select 'Number of stars' (Make sure it is the same as the content type you created above.).
  6. Select Voting Tag: Rating.
  7. Voting target: Parent Node.
  8. Make any other customizations.
  9. Save settings.
  10. Go to the comment display settings.
  11. Click the settings button (gear icon on the right side) for the "Rating" field.
  12. Change Value to display as stars: User's Vote.
  13. Change Text to display under the stars: User's vote
  14. Make any other customizations.
  15. Click update.
  16. Click save.
  17. Voila!
  18. P.S. If you use 7x-2.x version of fivestar module, please, first check out this issue to make it work according to new voting api changes. NOTE: The whole setup works just fine with Fivestar 7.x-2.x-dev from 2014-Mar-24 and Voting API 7.x-2.12

Help improve this page

Page status: No known problems

You can: