My goal was to use VUD to allow users to rate comments and then sort comments by their vote total.
I enabled voting then went about doing the sorting.
It would have been nice if the content type would, after having comments on that content type been enabled for voting, have offered an additional setting for comment display order. (see /admin/content/types//edit)
By default, one can only sort by date ascending or descending. It would be neato if VUD comments would also allow ordering by number of votes on the comment.
See also: http://drupal.org/node/628890
Comments
Comment #1
Stevo_0 commentedI would be extreamely interested in something like this!
Comment #2
jumpfightgo commentedYes this would be very, very useful!
Comment #3
pedroqalm commentedI would be very, very interested as well.
And I find it very strange that no one coded this yet. This is the reason for voting, praise the best and relegate the worst.
Comment #4
thepaul commentedWithout the ability to order comments by vote or even display the comment with the most votes (via a view) .. I'm not sure I understand the purpose of allowing votes on comments at all?
Comment #5
jumpfightgo commentedIn drupal 7 there still aren't any hooks for ordering comments beyond the default. See comments API (in fact there are fewer options in 7).
So Views 2 is our ONLY option for sorting comments without totally hacking core, in other words you have to render your comments with views in order to allow sorting by vote results.
Fortunately the Voting API already provides vote count integration with views.
You can do this by creating a new view, and adding a "vote results" relationship. Now you can sort by # votes.
Unfortunately the only way to allow the user to select the sort option is by using the "table" display, which is not really usable without totally overriding the theme, but at least it's possible...
Comment #6
CarbonPig commentedsubscribe
Comment #7
awolfey commentedI've tried #5 using a node view and a comment view, using VUD dev. I can't get the VUD widget to show in a view. I don't see sort or display options for total votes.
Here are my options for sorting: http://gyazo.com/08257c7cb74010476a0850a3032aec1b.png
Here are my options for adding fields: http://gyazo.com/7af78df66c4b8a907c79bf72eecec233.png
What am I missing?
Comment #8
awolfey commentedOK, I'm not so dense after all.
To get the widget to display I called the theme function from a views_customfield php field like this:
The vote total is kind of mislabeled. Currently it's "Vote Results: Value, The value of an individual cast vote." But it's not the value of an individual cast vote, it's the result of the aggregation function chosen in the relationship (Total score, number of votes, average votes) on all votes cast on a comment.
This is using a comments view.
Maybe this can help someone down the road.
Comment #9
Flying Drupalist commentedThanks awolfey,
perhaps this module is useful as well:
http://drupal.org/project/comments_in_a_view
Comment #10
toddgee commentedGiven the comments posted in #5, this should likely be closed in favor of the other feature enhancement I opened for VUD: http://drupal.org/node/628890
(that one was marked as a dupe; but not listed what it was duplicating, so I reopened it
Comment #12
jsommers commentedGuys, this issue is not fixed and I don't understand why this is so difficult to accomplish in Drupal. If you use views to display your comments, it breaks threading completely. So If I sort by vote, it displays each comment as a separate comments, not attached. Not to mention Ajax Comments is useless when you start using views to power your comment display. thePaul at #4 had it right.
This isn't so much a problem with VUD then it is with Drupal, but I don't understand why every one of these threads always stop at the views solution. We need a real solution to integrate with the comment module itself.
Am I to understand that even if I wanted to hack core, I couldn't accomplish this task? It seems to me it is just a matter of changing the sort query, but I have had no luck doing this successfully.
This is an important feature and I would appreciate it if anyone could share a better solution.
Comment #13
marvil07 commentedAbout the original question, as mentioned by others, is something we can not do from outside AFAIK, so the proposed view solution makes sense, but there are restrictions, as was also mentioned. IIRC merlinofchaos told me once that the actual "suggested way to let users change sorting in a view" is actually make many displays as tabs :-/, so that seems to be a little tricky too.
I am really not convinced about this feature, since IMHO is out of the scope of the module for the reasons mentioned.
About the "use widgets in a comment view", add the "Vote Up/Down: Comment Widget" field to your comment view.
Comment #14
jthomasbailey commentedSorry to open this again after the maintainer said it's a "won't fix" but I'm willing to pay for this feature and I'd like to know the best way to implement it. Is a separate module that creates the option in the content-type/comment settings for "sort by votes, threaded" the way to go?
Comment #15
userok commentedJust curious, wouldn't something like this help with performance issues as well--as opposed to installing views just to sort votes?
Comment #16
Fidelix commentedSubscribing...
Need this for a project.
Comment #17
janusman commentedMaybe this could help:
- use nodecomments module to turn certain nodetypes' comments into nodes.
- add vote/up down to the new nodetype
- alter the included view in nodecomments to handle sorting by votes
I imagine the main problem is getting threading to work... but if, say, the view sorts items only within a thread, and child threads are each ordered by the same view, it could work.
Comment #18
janusman commentedOne other thing; I doubt ordering just by votes would be the way the big boys do it. They probably have some sort of algorithm taking into account things like "up" vs "down" percentage, the reputability of the commenting user, total votes, comment word length, etc.
Comment #19
marvil07 commentedAfter two months being re-opened, I'm re-closing it as #13, IMHO the better way to deal with this is definitely views, but as mentioned, a little out of scope of the module.
If someone provide code for this, I could revisit this.