Problems with deleting ratings in fivestar_comment
| Project: | Fivestar |
| Version: | 6.x-1.18 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Jump to:
I've been seeing problems whereby if a user has rated content from within a comment via the fivestar_comment module, and then tries to edit the comment to remove the rating, it is not properly deleted.
What happens is that although the rating is removed from the comment, it remains in the main votingapi data structures and so is still included in things like the average rating.
Having looked through the code, it appears there are two problems:
1) At one point where fivestar_comment_delete() is called, it is being passed a user_id instead of a vote_id.
2) Vote IDs are not being stored in the fivestar_comment database table properly, and so even after fixing (1), the correct vote_id is still not used to try and delete the vote.
I've attached a patch that fixes both these issues (although it obviously won't fix any existing bad entries in the database).
For reference, I'm using fivestar-6.x-1.18 and votingapi-6.x-2.3.
| Attachment | Size |
|---|---|
| fivestar.patch | 1.4 KB |

#1
Have the same issue. Applied the patch. Works perfectly.
#2
Woot! Thanks for that--worked for me too! I really appreciate you tracking the problem down!
#3
This was an amazing patch, thank you! You solved a problem I've been ripping my hair out to solve! You are my #1 hero! WOOOHOOO! :D
For refrence: I used the same versions as the "patchman" :)
#4
I have tried patch, and it works for deletion of registered user's vote. But if anonymous users are allowed to vote and their comment plus vote is deleted, average isn't updated, it still registers a vote.