I tried adding new votes by adding new variables of the type 'vote', but this didn't really work (since some of the necessary data wasn't writable).
Eventually I ended up writing a new action for casting a vote, which makes sense to me. Patch will be attached when I get an issue number for this.
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | Untitled-1.jpg | 136.55 KB | noodlescainzos |
| #31 | Untitled-2.jpg | 83.32 KB | noodlescainzos |
Comments
Comment #1
itangalo commentedPatch attached!
(With the action you can set *any* voting value you like, even +100 for a vote that normally only accepts +/- 1. This is intentional – it is actually the very feature I'm after.)
Comment #2
itangalo commentedComment #3
Energyblazar commentedWow !!! will be using it and post back the results shortly ...
Comment #4
Energyblazar commentedHello can u tell me how do i apply this patch on a live site ?
Comment #5
itangalo commented@Energyblazar: To properly apply the patch you will need Git or some equivalent tool on your live site. If you haven't got that, you could always 'apply' it manually by just entering in the new lines in the module code. The patch file tells which files and at which rows the lines should be added.
(I'm not sure it's a good idea to apply this on a live site, though, but that's your choice.)
Comment #6
andypostSuppose this functionality should have reverse action to remove vote
Comment #7
beatnikdude commented@Itangalo I can verify that this patch works for me and I am able to use Rules to cast new votes.
@Energyblazar Applying patches
Comment #8
andypostThis patch needs re-roll (remove trailing white-spaces) and some work to include actions to remove vote
Comment #9
beatnikdude commentedI don't think the patch needs to be held up for the additional functionality of removing votes. Not a bad addition, but I think the likely use case is to prepopulate votes, it is for me.
Comment #10
timb commentedI just used this patch to prepopulate a five star field with votes before allowing anon voting. Works great.
Comment #11
Energyblazar commentedhow did u do it timb ?
Comment #12
timb commented@Energyblazar: I found the easiest way to create a new vote on a node: is to load a node that has already been voted on and then use it's vote values to populate the values on a new vote, except for maybe changing out the score. confusing? ... maybe a pic would help
Comment #13
Energyblazar commentedheya timb thanks...
but still i am not able to figure out what ya have done even after watching screenshot of yours...
I tried to go to Rules > Add a New Rule , no where in any of the chosen option could i find these "Entity to vote on", "Voting User","Voting Value", "Vote Tag" stuff.
Can you please explain a little more in detail.
P.S: I am fairly new to this drupal and rules thingy...
Thank you...
Comment #14
timb commentedyo e.b.: it sounds like you may not have the module patched properly. Try the instructions in comment #7 to manually use the patch command. In my install it appears as: Add new rule => Cast a vote
Comment #15
Energyblazar commentedHeya Timb...
Been two days and still i am clueless why i cant get the option "Cast A Vote" When i click on Add New Rules.
Please help me enlighten myself...I did add the patch manually.... here it is...thanks again
Comment #16
Energyblazar commentedCan anyone atleast give me a hint as to where i am going wrong or missing a thing or two ?
Comment #17
itangalo commentedEnergyblazar: Sorry, can't really see what's going on. Sorry.
Comment #18
Energyblazar commentedIts nothing complex...
If you see comment #12 timb has posted a screenshot, which he says, he achieved this rules functionality with use of your patch..
Now i did patch it manually using instructions on comment # 7.
But i am still unable to find Add new rule => "Cast a vote" functionality in rules...
Now can u look at the code and tell me wether i have applied the patch right ?
If i have applied it right then where excatly should i be looking for "Cast a Vote" functionality in rules ?
Comment #19
itangalo commentedEnergyBlazar: I can't see any mistakes in the code, but there might still be something missing.
If the code is correct, then you should be able to see – in the list of actions – a new action "Cast a vote". To have this appear you must first clear the cache, and of course also make sure that the module is enabled. (When enabling modules, all caches are cleared by default.)
Comment #20
Energyblazar commentedyes yes yes thank u Itangalo in actions there is cast a new vote.... silly me...i looked every where not in the list of actions...THANKS AGAIN !!!
Comment #21
mfoda commentedThanks for this patch. I'm trying to set up rules to cast a vote on one of two widgets depending on what the user selects for a boolean field in a node's comment form. After applying the patch I can see "Cast A Vote" as an option under the list of Actions. However, I'm not sure how to specify which of the two Rate widgets to vote on. I'm also getting an error when trying to input +1 as a voting value.
My current rule configuration:
Event: After Saving a New Comment
Conditions:
Content is of type X
Data comparison (checks if user chose the targeted boolean value)
Any ideas on how to show the two rating widgets in the data selector?
Thanks in advance.
Comment #22
Energyblazar commentedhmm... thats kinda complex part i guess u may need do some custom coding in rules for it.... here is some hint.. http://nodeone.se/sv/node/829
Comment #23
mfoda commented@Energyblazer
I'm not very good with code at the moment but I'll keep this for future reference. Thanks
Comment #24
timb commented@Energyblazer
I was able to copy a previously made vote from a set node then modify it before attaching it to a new node to guarantee certain values. See my comment #12
maybe this work in your case to load 2 different votes based on your boolean
Comment #25
mfoda commentedCan anyone who has used this with the Rate Module please provide a short description of the formatting used for the "Voting Value" field for each rate widget type.
In my case, I have a rate widget with values of type "option". In the rate widget page the values for my two options are numbered "1" and "2". When i go to the rules "cast a vote" configuration page I'm not sure what to input in the "vote value" field. I tried "1" and "+1" but neither seem to work. This could be the correct format and it's possible that it's not working because I made a mistake some where else.
Any ideas?
Comment #26
Energyblazar commentedThanks Timb looked at ur comment #12 and was trying to figure out how to get passed-node in Entity to vote on, vote-template:0:user in voting value, Voting value as passed-score and voting tag as vote-template:0:tag ..... but am still clueless how to achieve as you have done in your screenshot ... can u guide me better..
Comment #27
istryker commentedI think this issue should be top of the issue queue.
The silly thing about this issue, If user case a vote, and X condition is met, then set to previous vote and/or remove vote, then another vote has to be casted.
(Until there is a pre cast event)
Comment #28
web226 commentedThanks for this patch.
I got it working in rules by using a field to pass the default value (of 40) and then adding an offset (of 40)
In my case the ratings seem to be out of 100.
The value of 80 is passed to 'vote' which results in a 4/5 Fivestar rating on the node.
The Fivestar widget needed to be set to 'rating while viewing' on the content type.
Comment #29
rooby commented+ // @TODO: Add the 'value_type' parameter, now defaulting to percent.This also need to be fixed before committing.
It's not so useful without it.
Comment #30
rooby commentedIt's been a while since anyone else has worked on this so assigning to me and I'll make a few additions.
Comment #31
noodlescainzos commentedHello somebody can help me ? I installed the patch easy but when i configure my rule with a "after save a node" the vote that i configured is not made it.
My rule try to create a vote in a node referenced "node:field-usuario" (Entity reference field) when i created a specific node.
This are my screenshots
Comment #32
rooby commentedWhoops, this one totally slipped off my radar (if anyone else has this problem, show your support at #1621714: Allow to bookmark/favorite issues without abusing the Assigned field or issue tags :)).
I actually did make the changes I was talking about in #30, I just have to make a patch out of it.
Comment #33
noopal commentedHi
When I use rules I can create an action when a vote happens, but I cant create a vote as an action at all.
Has this been applied?