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)
- Go to the admin/config/content/fivestar
- Create a new Tag called "Rating" (e.g. vote, Rating).
- Go to your content type.
- Add a new Fivestar Field, called "Rating".
- Select Widget type: Stars (rated while viewing).
- Save Field.
- Select Tag: Rating.
- Save field Settings
- Select 'Number of stars' (Make sure it will be the same on both the content type and the comments
- 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
- Make any other customizations
- Save Settings
- Go to your content type's display settings.
- Click the settings button (gear icon on the right side) for the "Rating" field.
- Make sure Value to display as stars is set to 'Average Vote'
- Make any other customizations.
- Click 'update'
- Save your content type
Setting Up the Comments/Ratings
- Go to the comment field settings for the content type we just added our field to.
- Use 'Add existing field' and add the same 'Rating' field you used on the content type.
- Widget: "Stars (rated while editing)".
- Save Field.
- Select 'Number of stars' (Make sure it is the same as the content type you created above.).
- Select Voting Tag: Rating.
- Voting target: Parent Node.
- Make any other customizations.
- Save settings.
- Go to the comment display settings.
- Click the settings button (gear icon on the right side) for the "Rating" field.
- Change Value to display as stars: User's Vote.
- Change Text to display under the stars: User's vote
- Make any other customizations.
- Click update.
- Click save.
- Voila!
- 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:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion