CCK fivestar_field cast a vote if node is unpublished
sin - October 18, 2008 - 05:55
| Project: | Fivestar |
| Version: | 6.x-1.13 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Jump to:
Description
Hi!
It is about review nodes I described here:
http://drupal.org/node/318610
If the node with CCK fivestar field is unpublished it is still cast a vote. I think it is not consistent because users do not see unpublished node but see its vote on the other node.
This patch fixes insert and update of unpublished nodes so they do not cast a vote until published. It works at least for registered users vote. It may not always work for anonymous because we do not have vote_id to revoke specific vote, as I suggest in topic above.
| Attachment | Size |
|---|---|
| fivestar_field_status.patch | 849 bytes |

#1
I just realizd that my patch will not work because when the anonymous node will be published by admin the vote will be cast using admin's IP-address :( We can't just publish/unpublish anonymous votes until we got some vote moderation support in VotingAPI. Any ideas?
#2
A solution without touching VotingAPI... what if I store vote IP and timestamp in addition to rating and target columns in CCK content-type table? When I can safely delete the vote on review node unpublishing and cast it again on node publishing. This would also improve IP-based anonymous vote deletion.
This would require 2 new optional arguments in _fivestar_cast_vote() function: ip and timestamp. Is it a good solution?
#3
A more reliable method would be storing the vote_id in the CCK content-type table, then there would be no doubt at all about which vote was associated with the CCK field. This is the approach used by fivestar_comment module to keep track of votes when comments are deleted.
#4
Thanks, quicksketch, I thought about it but do not found where VotingAPI returns vote_id, I'l check fivestar_comment module.
#5
Hey sin and quicksketch,
The patch indeed doesn't work for anonymous users who leave votes which require admin approval: the vote for unpublished comments is still displayed.
However, that looks like a bright idea!
The reason why users use admin approval measure is mainly to prevent spammers from casting meaningless votes.
So, if we could somehow at least eliminate the showing of unapproved votes, the problem will be solved - an admin will come and delete the spam vote while the page remains intact shiny and spam free :)
#6
Any updates on this? (Showing unpublished comment votes is pretty much a show stopper for the fivestar comment module on my site).
#7
No. I didn't worked on this issue anymore.