Voting API with Views Support and Comments

gregarios - May 11, 2009 - 18:26
Project:Voting API
Version:6.x-2.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm actually not sure if this is a bug report or a feature request:

I've been struggling for a week trying to get some kind of "Top Comments" block to work using Views, Voting API, and Vote Up/Down module.

I use Fivestar Module for Node voting, and I use Vote Up/Down for comment voting. In the configuration for Vote Up/Down, you can set the "Voting API Tag" to be different than Fivestar's default of "vote" to eliminate conflicts in the database. This seems to work well, and I can have a block of top rated Nodes listed fairly easily using Views, that doesn't include Comment votes.

I've discovered what I think is my show stopper, though...

While it seems pretty simple to set up Node votes, it seems impossible to set up Comment votes in Views. I feel this may be because while the Voting API support in Views lets you choose which tag to use from the database, it only lets you pick them from a Relationship in "Node: Voting Results." I think what I might need is a section for Arguments and/or Relationships called "Comments: Voting Results" for it to work properly. This doesn't currently exist it seems.

When I try to use the Node: Voting Results to show the votes in Fields, they are all 0's (zeros), and it shows a list of all the comments on the site, voted on or not.

This is the query: (voteupdown is the name of the Voting API tag for comment votes)

SELECT node.nid AS nid,
   comments.subject AS comments_subject,
   comments.cid AS comments_cid,
   comments.nid AS comments_nid,
   votingapi_cache_node_voteupdown.value AS votingapi_cache_node_voteupdown_value
FROM node node
LEFT JOIN votingapi_cache votingapi_cache_node_voteupdown ON node.nid = votingapi_cache_node_voteupdown.content_id AND (votingapi_cache_node_voteupdown.content_type = 'node' AND votingapi_cache_node_voteupdown.tag = 'voteupdown')
LEFT JOIN comments comments ON node.nid = comments.nid
WHERE comments.cid IS NOT NULL

Does this make sense? Let me know if I need to clarify. It seems like "Comments: Voting Results" is missing or is not implemented in Views. Let me know if there is something I'm not understanding that will allow me to do this correctly, please. And, if not, can you implement it? Thank you.

~ G Piper

I'm running FreeBSD 6.3, Drupal 6.11, MySQL 5.0.75, PHP 5.2.9, Apache 2.2.11, jQuery Update 1.2.6, Views 6.x-2.5, Vote Up/Down 6.x-1.0-beta4.

#1

mErilainen - May 14, 2009 - 11:50

+1 for this feature

#2

mErilainen - May 14, 2009 - 11:50
Category:bug report» feature request

I think it's not implemented in Voting API at the moment, so it should be added to votingapi.views.inc file, if possible.

#3

ElGranAzul - June 14, 2009 - 15:07

+1 for this

#4

leovarg - June 14, 2009 - 16:23

same here! I wanna sort a list of nodes By Numbers of votes! But i dont see any options to do that in" views!" as i used to do in Views 5.
i have used both the 6. RC2 AND 6 DEV and any of those seems to have a correct integration of Views!

#5

gregarios - June 14, 2009 - 22:29

@leovarg: I assume you mean to sort nodes by it's comment-votes, as Views already allows you to sort nodes by node-votes.

#6

leovarg - June 15, 2009 - 18:36

hi Gregarios! ,
what i have now is a content type, with five starts votes!, with 3 taxonomies! what i wanna do is, make 3 views! each for each taxonomy name , then make a view that will bring a list of that content type. sorted from more to less voted node.
I knew how to do this! in drupal 5, was easy!. now in drupal 6 i dont see how to do this in views.

Oops never mind , i just discovered that i have to add a relationship before add a sort criteria

#7

ElGranAzul - June 18, 2009 - 13:27

This could be done with a custom SQL Query in views?

#8

gregarios - July 3, 2009 - 21:00
Version:6.x-2.0-rc2» 6.x-2.1
Status:active» fixed

This appears to have been fixed/updated in the latest version. I am now able to do "top comment" blocks. :-) Thank you! Marking this fixed.

#9

eaton - July 3, 2009 - 21:15

Hooray! Glad it's working for you. That definitely is one of the tweaks in the official 2.x release of VotingAPI. ;-)

#10

System Message - July 17, 2009 - 21:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.