Needs work
Project:
Fivestar
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Jan 2009 at 17:40 UTC
Updated:
14 May 2015 at 01:59 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
creamneuron commentedi 'm having the same problem. there is an option " alow user to undo vote", but this is not activated, but still the user can switch from 1 to five stars all the time.
1 click = 1 vote - and then no fuurther voting alowed should be the way, as i understand it. is it a bug? or is there something i miss?
greets
cream
Comment #2
lmakarovI used this patch for version 5.x-1.13:
in fivestar.module:
Find fivestar_vote function and comment the following lines:
Below add
in fivestar.js
look for
replace with
Works fine so far.
There should be definitely an option to disable re-voting in the module core.
So I'm also looking forward to see it.
Comment #3
dddave commentedI strongly second that re-voting should be preventable by module core (better yet:by default). Re-voting kills Fivestar to an certain degree because its results loose "credibility".
I personally am not very good in patching. Argh.... I will give it a try (and ruin my day ;( ).
However Fivestar is a really cool module.
Comment #4
foaad commentedhi inqui,
I tried this patch but it's not working for me. In Drupal 5.16, using IE7, I can duplicate the problem of endless re-voting by the same registered user.
After applying your patch to both .module and .js files and refreshing the page, when I click to re-vote it still lets me do it, i.e. the widget is clickable. But it also hangs forever saying "Saving your vote" until I reload the page.
any ideas?
Thanks.
Comment #5
quicksketchI don't know why this isn't clear: each user only gets one vote no matter how many times they click the widget. They're not repeatedly voting, they're just changing their vote. Even anonymous duplicate votes are prevented, despite the widget loosing it's value for anonymous users.
Comment #6
dddave commentedHi quicksketch,
I am very sorry but I really did not get it in the first place. I was testing it exstensivly and I could swear the text beneath the widget counted each vote.
At that time I was wondering how such a thing could be missed. Sorry for causing any inconvinience. I am going to change my vote at drupalmodules.
Thanks for this perfect module. :)
Comment #7
Apollo610 commentedQuick - I think the whole point of the thread (well, MY intent when I started the thread) was to find a way PREVENT the user from revoting - meaning prevent them from changing their vote (thus, voting again). I never referred to multiple votes for a single user...
Is there a way to just display a static version of the fivestar widget with the current statistics? It's probably just as simple as throwing an IF statement in the formatting.
Comment #8
quicksketchYes, you could easily do this in the current system by overriding theme_fivestar and then calling theme('fivestar_static') if the user has already voted.
Comment #9
Apollo610 commentedThanks quick - when I originally posted my inquiry I was a little greener to Drupal. Slowly getting there.
Now, in your opinion what's the best way to check to see if the user has voted? I've already themed the node in its own tpl.php, so that's where I'm adding my condition.
I did a DSM on the entire page and don't see any stored variables that I would be able to use for this condition, is that correct? Ideally I'd want to pull something like
$node->content['fivestar_widget']['myvote']['#value'].Thanks!
Comment #10
mapcuk commentedI wrote a patch for fix that.
And patched module here.
Comment #11
marvs commentedAdd this in template.php
if (!votingapi_select_votes(array('uid'=> $vars['user']->uid))) {
$vars['fivestar_widget'] = $vars['node']->content['fivestar_widget']['#value'];
}
else {
$vars['fivestar_widget'] = fivestar_static('node', $vars['node']->nid, NULL, $vars['node']->type);
}
Comment #12
halfabrain commentedDear all
I tried your solution and while it worked it was confusing as the comment still showed the vote option, only that they couldn't use it. I'm looking for a real rough and ready solution...
What I'm looking for is to write some PHP that will look to see if a user has already commented and/or voted on a node (in my site you have to vote when commenting, so either can be used) and if they have, echo '
.box{display:none;}' thereby removing the comment box completely.
However, my woeful PHP skills are letting me down and I can't make it work. Please can someone provide me with the code that I would need to make this happen?
Cheers
H
Comment #13
halfabrain commentedHello again everyone. Well I got my rough and ready solution to work by inserting this into the top of my comment.tpl.php file.
I know this is bad form for two reasons:
1. I have hacked a core module;
2. Using CSS is not ideal as it can be turned off and the site abused.
So if anyone can help me improve I would really appreciate it. Please can you tell me how I can amend the comment.tpl.php without hacking core and also can you tell me how I can simple say "comments not displayed" in Drupal if the above if statement is true?
Any help much appreciated,
Thanks
H
Comment #14
fhoubart commented+1 subscribing.
Very important for me to add this feature. Anyone?
Comment #15
fhoubart commentedComment #16
cepiat commentedi need to this request it's very very important for me , i try different solution but nothing really good.
Comment #17
deith commented+1 subscribing.
Comment #18
Luciuz commentedi have the same issue
Comment #19
jghyde commentedHere is a patch rolled against the latest CVS 6.x-2.x-dev. It does the following:
If the admin UNchecks the $settings['unvote_enable'] ---> 'Allow users to undo their votes. If this is not checked, the user will be presented with a static widget if they return to the page after previously submitting their vote,' the users who have already voted will be presented with the static widget.
The title of the widget is also changed to 'Thank You for Your Rating."
The code may be a little heavy, since it is required to lookup the vote for each $tag. But that's the only way I could make it work without more radical refactoring.
Joe aka Texas on irc
http://www.hydeinteractive.com/
Comment #20
wrd commentedI realize it's still in development, but just in case it hasn't been noticed yet, this is not the case in 7.x-2.x-dev. I can click the widget a dozen times, and see twelve additional votes tallied up on the node. I can see a tally of eleven votes on a single node, with an average rating of 47.2727 percent, on a system that has only two users (and is currently impossible for anonymous users to reach, as it's only accessible from my desktop).
Comment #21
Taxoman commentedSounds like a bug (..?!), and should be done for 7.x and then perhaps backported.
Comment #22
ericduran commented@taxonman, Is this a bug in the 7.x branch? If not it shouldn't be switch version also if it is please create a new issue for the 7.x branch.
Comment #23
pbuyle commentedMaybe this issue the 6.x version of #1155036: The module allows multiple vote from the same user for the same node ?
Comment #24
ericduran commentedThis is at best a feature request.
Later in the day I'll check out the patch.
Has anyone reviewed this patch? Does it apply cleanly?
Comment #25
Taxoman commented@ericduran: initially a feature request, yes, but then #1 states "i 'm having the same problem. there is an option " alow user to undo vote", but this is not activated, but still the user can switch from 1 to five stars all the time."
Therefore I assume it is perhaps also (combined with?) a bug?
Comment #26
ericduran commentedHey @ Taxoman,
If thats the case then comment #1 should open a new issue with his problem. The origin issue is for a feature request.
So we'll just leave it as a feature request for now. The allow users to undo their votes is a completely different topic which works as far as I can tell.
Comment #27
bojanz commentedI ran into this on 7.x
I have fivestar on comments, pointing to fivestar on the node. I can add 5 different comments with five different ratings. The node rating will only display the last one.
Makes sense to me that the widget is no longer present after the first vote (comment).
Comment #28
Sylense commentedsubscribe - D7.
i would like to prohibit a user from changing his/her vote. Possibly display a system error message that indicates that they have already voted or just replace the widget all together.
Comment #29
ramlev commentedI have made a patch for 7.x-2.0-alpha1 which adds a admin field setting to set if you want users to be able to changes the vote. If the user cannot re-vote, then the fivestar_static theme is fired, otherwise the fivestar_select theme function is fired.
Let me know if this works.
I will make a patch later on, which will work with the 7.x-2.x dev branch.
Comment #31
ramlev commentedHeres the patch that works for 7.x-2.x dev branch.
Comment #33
ramlev commentedChanged version, since we're on 7.x now
Comment #34
ramlev commented#31: dont-let-user-to-change-his-vote-or-revote-356605-30.patch queued for re-testing.
Comment #36
danihobbs commented#31 THANK YOU for this patch - you saved the day! It works perfectly.
Comment #37
ericduran commentedIf we could get the test passing I'll love to commit this.
Comment #38
BeaPower commentedIs this committed now?
Comment #39
ericduran commentedThis breaks the "User can cancel his vote" test. The test needs to be fixed. Once this is fixed then I have no problem committing this.
Comment #40
ramlev commentedNew patch created and added a test to test if re-voting is possible.
Comment #41
ramlev commentedComment #43
ramlev commentedNew try, removed a bunch of warnings.
Comment #44
BeaPower commentedwill this option be committed soon?
Comment #45
lhugg commentedAfter patching the dev version and replacing the fivestar alpha2 release with the patched dev code, the application threw the following errors when caches were cleared or existing fivestar fields were edited:
Warning: Cannot use a scalar value as an array in form_builder() (line 1800 of D:\xampp\htdocs\readerrap714\includes\form.inc).
Warning: Cannot use a scalar value as an array in form_builder() (line 1820 of D:\xampp\htdocs\readerrap714\includes\form.inc).
Warning: Cannot use a scalar value as an array in form_builder() (line 1825 of D:\xampp\htdocs\readerrap714\includes\form.inc).
Warning: Cannot use a scalar value as an array in form_builder() (line 1829 of D:\xampp\htdocs\readerrap714\includes\form.inc).
Warning: Cannot use a scalar value as an array in form_builder() (line 1725 of D:\xampp\htdocs\readerrap714\includes\form.inc).
Do we have to strip out everything we've already built using fivestar and redo the rating fields with the patched version?
Comment #46
lhugg commentedThis patch doesn't seem to work for fivestar ratings on comments that refer to a parent node.
The final decision on edit/noedit looks like it's make in "fivestar_allow_revote", but the $element array passed in does not contain $element['#settings']['content_id'] or $element['#settings']['content_type'], so the final boolean returned is TRUE meaning editing is allowed.
Comment #47
lhugg commentedThe errors in #45 were caused by '+'s and some other extra characters that were inserted into the patched code. Could have been caused by my patch utility, since no one else seems to be having this problem. If you do, just edit your final code to clean up.
Comment #48
lhugg commentedSorry for not understanding the protocol, but did I need to remark this 'active' when I posted #46 above in order to get someone to look at it? Setting to 'active' here.
I've tested the patch, and it doesn't seem to work - see #46.
Comment #49
ramlev commentedHave created a path which works with the alpha-2 release
Comment #50
ramlev commentedNew patch to alpha-2 with some fixes.
Comment #52
ramlev commentedPatch for alpha-1
Comment #53
ramlev commentedFixed bug in patch for alpha-1
Comment #55
teami commented#49: dont-let-user-to-change-his-vote-or-revote-for-alpha2-356605-49.patch queued for re-testing.
Comment #56
DevneelLoki commentedHas there been an update for this patch? Currently, leaving the "Allow users to cancel their ratings" unchecked still allows users to change their ratings.
Comment #57
cptlonestar commentedFollowing +1. I'm having the same issue as well. Unfortunately I'm a beginner in php and therefore cannot come up with a solution. Really looking forward to the updated module change that allows only one comment/rating per user.
Comment #58
cptlonestar commentedFor those of you who may not be PHP savy like me, I found a module that works great to limit a user vote AND comment to only once.
Comment Limit
It obviously doesn't upgrade Fivestar but it solves the immediate issue. See Issues - Where's the UI to configure the actual comment limit for individual nodes.
Comment #59
mxtIn replay to Bojanz in #27:
I've found a workaround for this, take a look to: http://drupal.org/node/211517#comment-7263148
This is useful for situations where you want people do comment more than one time but allow only and only one vote for pointed node.
Hope this help
Comment #60
matt.rad commentedSubscribing.
Comment #61
whiteph commentedRe #45 - this was a typo in the patch, in function theme_fivestar_preview_widget($variables). 'allow_revote' => TRUE, instead of '#allow_revote' => TRUE. That typo was fixed in later versions of the patch, but there was confusion due to naming of …alpha1 instead of …alpha2.
I've applied the patch from #50, as that was the one pertaining to alpha2, the latest version at the time the patch was created. I've fixed the typo.
I've also added fivestar_update_7206(). This sets all existing fivestar widgets to have re-voting allowed, otherwise 20,000+ sites running fivestar may get a surprise to find that the existing behaviour of allowing re-voting is now being blocked.
So, be sure to run the update program before you edit your fivestar widgets in the admin system, otherwise when the update program runs you'll lose any changes you make allowing re-voting.