Hi Nathan & Jeff,

I believe that when "Allow users to undo their votes" (fivestar_unvote) is checked and a user "undoes" their vote, the process of deleting the vote should be run through the VotingAPI. This allows other modules to be triggered when a Fivestar vote is undone (deleted).

Attached is a patch that contains the code changes that support this.

I look forward to your review!

Mike

Comments

mpaler’s picture

Status: Needs review » Active

Did I post this under the wrong status? Perhaps Drupal 6 has messed up the whole curve... :(

quicksketch’s picture

Status: Active » Needs work

That's a really good point. I'm not sure why we're not using votingapi_delete_vote in Drupal 5 (we are in Drupal 6 though). Jeff wrote the original Voting API implementation for Fivestar, so I'm guessing it's something to do with the support for anonymous votes (which isn't supported in Drupal 5 AFAIK). I'll ping Jeff and see if he has additional input on this issue.

In the mean time, could you format your patch according to the Drupal coding standards? There's a few problems like using tabs instead of spaces, spaces at the end of line numbers, and putting } else { all on one line. See http://drupal.org/coding-standards.

xenostar’s picture

This is a test of the emergency broadcast system.

mpaler’s picture

StatusFileSize
new3.45 KB

Not sure what xenostar is testing....however, attached is a (hopefully) correct patch.

Please let me know if it still needs work.

Thanks,
Michael

kmillecam’s picture

Bump.

This is actually a critical patch for users of User Points.

I just had a user report that he could vote (and earn points), then delete his vote and vote again (to earn more points).

Not a good scenario (unless you're trying to scam the system).

+1 for incorporating this patch into the API.

Thanks,
Kevin

quicksketch’s picture

Status: Needs work » Fixed

I couldn't find any problems with this approach in my testing, plus it seems like it's something that's a good idea anyway. I cleaned up the patch a bit (still a few whitespace issues) and committed. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.