In drupal 7 i have created a fivestar field and a user reference field in the comment form, enabled in the Organic Group Content type.
This field is supposed to reference 2 entities the group and the member/user to who the comment is referenced via User reference module.
Now i was able to reference one entity type i.e. the group where the comment is posted with help of this documentation ..... http://drupal.org/node/1308114
But am still searching for a way to reference the same vote to the user.
Example: Bill, Tim and Meena are members of Group Awesome.
Bill logins visits the content page (group page) and cast a vote referencing meena in the user reference field.
Then the vote is referenced to the group awesome as well as meena.
Thank's in advance for your time.....
Comment | File | Size | Author |
---|---|---|---|
#9 | Screenshot at 2012-03-14 23:24:42.png | 70.12 KB | Energyblazar |
#9 | Screenshot at 2012-03-14 23:23:55.png | 102.04 KB | Energyblazar |
#5 | 1481502-fivestar-author-target.patch | 825 bytes | ericduran |
Comments
Comment #1
ericduran CreditAttribution: ericduran commentedOh, Sadly this is not currently possible at least not without writing a custom fivestar target.
The problem is that right now the votes are only targeted at a single entity (it could be a node, group, user, etc..) but only one.
Sorry, I imagine this is not the answer you're looking for. That being said you might want to look at the fivestar.api.php file for examples on how to add new voting targets. Even thought at the time of writing it was not expected that people would want to vote to multiple targets so not really sure it even allows you to do that. But you should be able to extend it or at least cast the vote manually in the hook.
Hope this is somewhat helpful.
Comment #2
ericduran CreditAttribution: ericduran commentedOh another solution could be to set up another Fivestar field, that references the group node. And have that field populated with the same value as the fivestar field that's referencing the user. And possible try to accomplish both of the fields being the same with rules, or using hook_node_presave. You could also hide one of the fields so they don't show up twice.
This would probably be the easier route, but still would require some code.
Comment #3
Energyblazar CreditAttribution: Energyblazar commented"The problem is that right now the votes are only targeted at a single entity (it could be a node, group, user, etc..) but only one. "
as u said can be targeted to one entity......How do i target the votes to the users ?
Comment #4
ericduran CreditAttribution: ericduran commentedAhh, I see what you want to do. You want to Target the author of the parent node from the comments. Is this correct?
Sadly this isn't possible but it's should be pretty easy to add.
I'll whip up a quick patch.
Comment #5
ericduran CreditAttribution: ericduran commentedHere's a patch that should add this functionality.
It also seems we're missing User referencing from a user_reference field.
If you don't mind testing this out. This will give you another option on the comment fivestar field, to let you reference the Parent Node : Author.
Let me know. Hope this helps.
Comment #6
Energyblazar CreditAttribution: Energyblazar commented#5: 1481502-fivestar-author-target.patch queued for re-testing.
Comment #7
Energyblazar CreditAttribution: Energyblazar commentedAmazing u already created a patch !!!
Just one more thing i am using the fivestar module on a live site and being beginner r i am clueless how do i use this patch on a live site. I did google for possible solutions but all i could get was tutorials using drush to update a patch, but none on live site.
So i tried to manually
Here is what i did (code starting from line 741)
Comment #8
Energyblazar CreditAttribution: Energyblazar commentedNO use getting this message after doing the above mentioned changes :- Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/nithin/public_html/drupaltest/sites/all/modules/fivestar/fivestar.module on line 753.
How do i use this patch on a live site .....???
and also in this code (i also suck @ coding so plz educate me)
Comment #9
Energyblazar CreditAttribution: Energyblazar commentedAlso i have attached 2 screenshots ..... please have a look at them ......
I simply want to reference the vote to the user/member selected in the user reference field 9created using reference module) not the author of the content type (group)...
Thanks again for all your time and efforts.... :)
Comment #10
Energyblazar CreditAttribution: Energyblazar commentedFinally figured out how to apply the code manually here it is and its working right.
Comment #11
Energyblazar CreditAttribution: Energyblazar commentedok now there is one problem if user "Master" votes in another group his existing vote is over written. Thus if user "Master" is part of 2 groups "Group awesome" & "Group Superb", and he caste's vote in Group awesome & then comes and caste's vote in Group superb then his first vote is over written.
Comment #12
Energyblazar CreditAttribution: Energyblazar commentedhey @ ericduran your patch works perfect,(understood it by reading http://drupal.org/node/1274426#comment-4975152 ) but it links the vote to the voter i.e. comment author itself. Going to try out this patch http://drupal.org/node/1488914 named "fivestar-support_entityreference_1488914-6.patch"