Closed (fixed)
Project:
Vote Up/Down
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
31 Aug 2009 at 07:11 UTC
Updated:
20 Dec 2011 at 21:58 UTC
Jump to comment: Most recent file
Comments
Comment #1
ingo86 commentedThe new vote up down module should have the ability to change widget easier than the 1.x branch. I move this issue to that, you could have more luck.
Comment #2
davedg629 commentedyes i am very interested in this feature. I want to have yes/no voting for a certain node type. The widget stuff is easy as long as you have a little experience with theming/css. I am getting stuck with calculating the total number of yes (up) votes and total number of no (down) votes.
There is an issue (http://drupal.org/node/413980) that gives a possible solution, but it is for the 1.x branch. Plus after I implemented this solution I had some problems with the display of the results and clearing the old results. Not to mention the anonymous voting for the 2.x branch is awesome!
There has to be a fairly easy patch (for someone who knows module development) where you can count the number of yes (up) votes and the number of no (down) votes. I'll play with the files and see if I can come up with anything, but to be honest I don't really know what I am doing.
The next step would be integrating these yes/no results into a view.
Comment #3
crea commentedWell i'm sure you don't need any patch for getting number of votes. Getting number of votes should be easy with standard VotingAPI functions, i.e. votingapi_select_results().
If you managed to get this voting widget to work can you please post your steps ?
Comment #4
davedg629 commentedwell I am having a extremely hard time figuring this out. I'd post my code but just really have no idea what im doing.
Comment #5
vood002 commented@davedg629: Your request is pretty simple with the 2.x branch.
The only Issue I see in your way is that there is no way to put the widget after the content of the node...at least none I see. The weight of -10 is hard coded in the node_api implementation. In the 1.x branch you were able to disable the widget entirely for a node (ie: "Do not show in full view or teaser"), then call the widget ( what you'd use now is vud_votes_proxy() ). Best as I can tell, a little module hack of changing the weight to
2from-10is the only way to accomplish what you're trying to do.Perhaps another option is to not enable vud for your node-type on the vud configuration page, then call the widget manually using vud_votes_proxy(). I think this would work.
Everything else you need to do can be accomplished easily using the templating system. I haven't refined my CSS, but I've attached it here for you to get you started:
and the twidget.tpl.php file, something like this:
Comment #6
crea commentedThanks, vood002.
I will try this later. If there are problems with weights, I may publish a patch to the vud module.
Comment #7
Ela commentedsubscribing.. wondering if this was implemented yet in the dev version? I was interested in using this module for that exact feature, on rating comments as useful or not ...
Comment #8
danielpacker commentedI just implemented a "was this review helpful" solution by duplicating the "updown" widget theme included in the 2.x branch and adding the text to the widget in widget.tpl.php. Just enabled vote up/down and vote up/down node and configure vote up/down to displaye on your node type. Then copy the theme directory and modify the widget code and select that widget theme in vote up/down options. Super simple, though a widget label feature would be nice out of the box. :)
Comment #9
vood002 commentedI've created a new feature request to be able to change the weight of the widget at http://drupal.org/node/736338.
In my code I hardcoded the node_api weight to 10, so it shows up after the node body. I've attached the widget I built, a very simple modification upon 'plain'. It works great for me, you may want to change it a little bit (especially the widget.tpl.php).
Comment #10
marvil07 commentedYou can change the weight like I mentioned in #736338: Ability to change weight of widget in order to display it after the node body.
About changing the way the widget is shown, you can implement your own widget, please take a look at WIDGETAPI.txt.
About solving the issue mentioned by crea at the start of this issue, maybe is a straight forward solution to use flag module. (aka we love diversity ;-))
Comment #11
crea commentedFlag can't be used for this: it's a binary system (vote/no vote) , while "was this useful ?" is a ternary system (yes/no/no vote).
Comment #12
marvil07 commentedflag empty = no vote?
Comment #13
crea commentedYes, empty flag = lack of vote. There is no "No" option.
Comment #14
marvil07 commentedOk, sorry for misunderstood the issue, after re-reading..
I can only answer the second question: it's possible when #745058: add a hook to preprocess variables passed to widget.tpl.php is done, because you'll have the opportunity to change variables, including the score.
Comment #15
marvil07 commentedtrying to answer the 1st question:
I think it would be possible to do that also when the issue mentioned is done, so you can place a special class to identify non-voted widgets and also adding some js to handle those classes
Comment #17
peter.walter commentedI implemented a was this helpful type voting on my site by creating an additional widget - see attached patch.
Comment #18
peter.walter commentedSorry, Ignore #17 - patch had absolute path
I implemented a was this helpful type voting on my site by creating an additional widget - see attached patch.
Comment #19
john.money commentedThanks useful/helpful widget in #18.
It seems to be missing the alter template variables function. Attached patch fixes this and adds in the reset link, if available.
Comment #20
marvil07 commented@expandonline, @John Money: Thanks for the patches.
This is a support request issue against 6.x-2.x, so patches here are not really expected. alter template variables widget callback was added only on 6.x-3.x branch.
Anyway, now 6.x-3.x is the stable branch, and 7.x-1.x the development branch, so all new features(like a new widget) should be added there. So if there is interest about this, please open a new feature request issue on 7.x-1.x version.
Closing this issue again.