4

This is a quite regular feature request on the Drupal website (see for example this article), but there hasn't been provided a full answer anywhere and the answers only cover Drupal 6.

Instead of rating content with whole stars, I'd like my users to be able to vote with half stars (0.5, 1, 1.5, 2, etc.). On my website, voting on nodes happens via comments.

How can I achieve this? Which CSS and/or PHP changes do I eventually have to make to the Fivestar module?

  • I found a module, but we need to give input as text (at the time of node creation) the output will rendered as stars.half starts works for this.But user can't rate starts at output. – Krishna Mohan Apr 4 '14 at 6:00
  • I've just put a fix in place based on that error but not had a chance to test it yet. I've only tried it in one environment so will need a bit more work yet I suspect. The same link has the updated copy. – Felix Eve Apr 7 '14 at 8:34
  • 1
    @FelixEve: Thanks for your help. The error messages disappeared, but I still can't vote with half stars in a comment. When I expose the node's Fivestar field for voting, I get an error and strange things happen: after voting, 10 stars are displayed in the node and 2.5 stars are displayed in the comment. Also, the average score isn't updated. I'm sure you can get it completely right after some testing. – Jeroen Apr 7 '14 at 16:05
  • Sorry - your being a proper guinea pig! I've spotted the issue and done some more testing and is working fine for me on a fresh install now. Same link updated again - I hope it will work for you this time. I've put it on DO here but waiting to get though the peer review process. – Felix Eve Apr 8 '14 at 8:45
  • @FelixEve: I have great news: after some testing, Halfstar finally seems to work for my purposes! I'll therefore accept your answer and post future issues to drupal.org/project/issues/2233333?status=All&categories=All. I'm sure I may thank you for your formidable module in the name of every Fivestar user! – Jeroen Apr 8 '14 at 12:28
7

I've written a module that alters the fivestar module to allow halfstar voting:

Halfstar

After installing the module an option is added to the field instance setting form allowing half star voting:

enter image description here

Which then allows voting with half stars:

enter image description here

There is a rounding bug that occurs occasionally at the moment when using the Stars (rated while editing) widget. If you have 9 stars and then vote 5.5 is display as 5.6.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.