Active
Project:
Fivestar
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Jan 2008 at 09:50 UTC
Updated:
20 Apr 2014 at 11:20 UTC
Jump to comment: Most recent
With rating on comments enabled as optional, I noticed that a user is able to vote on the content on multiple comments.
It doesn't look like these comment ratings are actually getting tallied up anywhere, and are for a visual reference, but it seems odd that people could make multiple parent comments and be able to vote multiple times.
Is this by design?
Or is it hard to check to see if the user has already submitted a rating on a comment?
Should these comments be tallied up somewhere as well?
Comments
Comment #1
KentBye commentedOkay, so it appears as that the LAST comment rating is being counted as the vote by each user in the master talley.
However, the question remains why should a user be able to rate via comment multiple times?
Comment #2
jsenich commentedSubscribe.
This seems odd to me too and is preventing me from using fivestar instead of the userreview module. I'm not sure what the correct solution would be though.
Comment #3
quicksketchOh good I was hoping for some discussion on this point. I've been thinking I want to add a single checkbox for "Limit ratings to a single comment" (or something similar).
The most logical functionality of this checkbox would be to only allow a single "root-level" comment (the kind that can leave ratings). It gets a little hairy when dealing with the comment form listed below the list of comments though, because the entire form will need to be replaced with a message that you can only edit your existing comment, not submit another one. In any case, I think it's the most logical way to handle this. What do you guys think?
Comment #4
jsenich commentedYeah, that makes sense to me. It's sort of the way that I imagined it working when I first tried it out and being used to using the userreview module. I don't know if it's been discussed anywhere else but I'd also like to see a way to disable the voting functionality for the widget in the main node when using the ratings in comments.
Comment #5
quicksketchjsenich: as a quick fix for your request, you can simply set the widget display to
<hidden>for the teaser and full node view.Comment #6
garg_art commentedHow can comments be rated. I thought this functionality does not exist.
How do turn on the "optional" rating to rate the "comments" left behind by others on a website.
This is distinct from rating the content itself.
Comment #7
igorik commentedstill active
Please, could you add checkbox "one comment rating only" to admin section or something similar?
if you think that this bug is reasonable.
it is needed for both rating options - required/option
thanks
igorik
http://www.somvprahe.sk
Comment #8
Leeteq commentedSubscribing.
Comment #9
gollyg commentedI feel that it would be better to allow multiple commenting, but only a single vote. Locking the user to a single comment really excludes them from any further participation in the conversation/debate - ie they could not reply to other peoples comments.
Also, would a user be allowed to edit their comment if someone had replied to that comment? I think that the default behaviour is for a comment to be locked once someone has replied to it, preventing them from retrospectively changing their argument.
My preference would be to allow them to vote on their first comment, but then lock in that vote (ie they can't change their vote). On subsequent comment forms for that user, it would display a disabled voting widget set to their current vote, with a message explaining why the vote was locked.
Once the comment was submitted, the comment display would either not show any voting widget, or it would again show a visually disabled widget (eg greyed out, but revealing the users previous vote).
Comment #10
quicksketchNew features are only being added to the 2.x version now.
Comment #11
Oleksa-1 commentedYou need to insert this code:
in fivestar_comment.module
at least it works for node. Regarding comments Alter comment links. You need to unset reply_link in template.php of your theme or use patch from http://drupal.org/node/374463
Comment #12
Oleksa-1 commentedComment #13
mikejonesok commentedHow would you limit it for just one node type?
Comment #14
Coupon Code Swap commentedhttp://drupal.org/node/211517#comment-2505568
The problem with this approach is that it prevents a user from adding any further comments to a node. Not very user-friendly or desirable since it prevents conversations.
Ideally there would be two options. The first is already taken care of: allowing a rating for each comment with individual vote displayed in each comment.
The second option should be one comment vote per node, that is reflected in the average and then the voting widget is not displayed for any further comments the user makes on the node. Perhaps a check to see if the user has already voted in a previous comment and then unset the voting widget on comment form.
Comment #15
MacaroniDuck commentedSubscribe. I definitely need this functionality (i.e. user can continue to make comments, but either a) cannot change vote or b) is at least warned in some way that voting again will cancel out their previous vote). There's been little talk of this in the last few months. Has it been abandoned as a possible new feature?
Comment #16
gorillaz.f commentedany updates for this issue ? i guess it would be a nice feature to prevent user from rating more than once
Comment #17
NathanM commentedAlso interested in this. I was looking into using comment_limit, but it seems like it is broken with the latest versions of node comment.
Comment #18
mxtIs there a solution for this in 7 version?
Please help!
Comment #19
WebmistressM commentedI am also subscribing to this too. For most content, its nice to be able to comment on a given node more than once so that they can continue the conversation. However, in the case of doing reviews on something, it seems natural that most people would want to prevent users from "stuffing the ballot box" by being able to vote on a given node more than once.
Comment #20
ronino commentedIn my opinion, it is too late to decide what to do with multiple votes of the same user when we are already about to save the vote. But this is what Fivestar does, just delete all previous votes and save the new one. As KentBye writes, this leads to several comments of the same user with different votes, but only the last vote is saved and respected in the average vote.
I think it would be way better to not even allow the user to vote again in the UI if he/she has already done so. Voting API saves the IP and uid for each vote which works for registered users, but the IP is not sufficient for anonymous ones. So a better way could be to save a user's last voting timestamp in the session and just not display the Fivestar voting field to him/her if the time difference is too short (or is under the limit set in the "votingapi_anonymous_window" variable).
As Fivestar doesn't have a setting whether to allow multiple votes per user or not, the current behavior is inconsistent. There should be either a setting for that or any vote should be saved as it comes, no matter how often a user votes, to make the votes on the page represent what's actually in the database.
I created a patch for the D7 version of Fivestar to correctly (in my opinion) insert, update and delete all single and multiple votes. As this issue is about "preventing multiple ratings", this might not be the right issue to post it. #561622: Allow multiple votes per user per target might be better but it's about D6.
Comment #21
mxtI think that, simply, we should have an option somewhere like "hide voting options for comment rating if a user has already voted".
But first there are some changing in voting api that have to be resolved:
Add pre-save or pre-set hook before data is store to database to let other modules to know whether a user has voted on the content before (and then hide the voting interface). A patch for this already exists but it has not ben committed yet.
Comment #22
Timusan commentedHey Garg_art
I just proposed a patch that adds this very functionality (asked for in reply #6), see issue #1916068: Add the ability to rate parent comments (recursively)
Cheers
Tim
Comment #23
mxtHi all,
I think I've found a workaround: simply you have to implement hook_form_alter for the comment form and check if user has already voted for that node. If yes, you can unset the rating field.
Here's the code:
This works like a charm for me.
Comment #24
cptlonestar commentedHi MXT,
Thank you posting a possible solution. Did you put this code in the fivestar.module file? If so, did you enter it at the very end of the page? I'm still learning how to work with modules/php but any help to get this to work correctly is very appreciated. Thank you.
Comment #25
mxt@Cptlonestar, usually is not a good idea to hack existing modules.
Simply you have to create your custom module with code I posted above, enable it in Drupal, and you are ready.
Notice I've named the function yourmodule_form_alter: you have to use your module name here. Same for "yournodetype" some lines after: here you have to use the machine name of your node type.
Comment #26
mariusm commented#23 it's work for me
!
change
unset($form['field_rating']); with unset($form['field_yourfieldname']);
Comment #27
cptlonestar commentedFinally I have found two solutions that both work in different ways. I wanted to post both solutions for future help to anyone lost and looking like I was.
1. Comment number 23: Removes the rating field after a user votes the first time. It still allows the user to submit additional comments but not change their rating. I created a new module called "One Vote" and activated the module. It was fairly easy once I understood what was needed. A very big thank you to MXT for coming up with this solution!
2. Comment Limit Module: this works great if you do not want the user to have the ability to rate or comment again. It simply removes the "Add New Comment" form and tells the user they have reached their maximum comment limit.
Hope that closes the issue finally!
Comment #28
mxtHere's the complete code, with an useful addition:
last function hides rating widget for comments where users gives no votes.
Hope this help
MXT
Comment #29
mariusm commentedHello,
Thanks for your module.
Please add a function to hide rating for reply to comment.
Thanks
Comment #30
roadran422 commented@Cptlonestar
Can you upload the module you used?
Comment #31
cptlonestar commentedI just used the module code posted by MXT above in the comments. You have to insert the name of your module wherever it says "yourmodule" in the code such as "one_vote." Then create a new folder under the folder sites-->all -->modules called One Vote. In this folder, your going to include two files: 1. one_vote.module (with the code posted by MXT). 2. one_vote.info (see the documentation on how to create an info file). Then activate the file under admin/modules on your website. That's it.
Comment #32
hem_awalker commentedI would like to see the option to tally all the comments.
I have an intranet page for each of our suppliers, that I want people within the company to rate.
I'll slap the wrists of people entering multiple times to influence results, but the same user may use the supplier multiple times and rate them, each time, accordingly.
Hence I need multiple comments from the same user to count multiple times.
Comment #33
mxtPlease don't arbitrarily change D version.
We are concentrating efforts on D7 and workaround posted in #28 works for D7.
After a working solution was found for D7, you can always open an issue to backport for D6.
Thank you.
Comment #34
ruhsnet commentedI could need some help here.
I created a onevote.module file like this:
Then a onevote.info like this:
Put it into sites/all/module/onevote.
Then i enabled the module. All I see now is all text inside .module at the top and at the bottom of my page.
Please help me!
/Johan
Comment #35
haunted commented#23 works fine but in addition to not being able to vote more than once, users can not change their first vote. Is there a way to prevent from voting twice but allow to modify the first vote?
Thanks.
Comment #36
cptlonestar commentedHaunted if you update the fivestar module with the most recent release it now allows the admin to set this in the content type field settings (www.yoursite.com/admin/structure/types/your-content-type-name/fields/you...) where it says: "Allow users to re-vote on already voted content."
Hope that solves the issue
Comment #37
haunted commented@Cptlonestar Thank you, i have the most recent fivstar release, and the option " Allow users to re-vote on already voted content" is selected, but if i install and enable the module in #28, when editing the first comment (and vote) i'm not able to modify the vote.