Closed (fixed)
Project:
Vote Up/Down
Version:
6.x-3.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 Apr 2013 at 11:25 UTC
Updated:
12 Apr 2013 at 00:41 UTC
I want to have voting separated by roles on my site. My strategy to accomplish this was going to be to display two VUD widgets, one which is linked to a tag "A" and one which is linked to a tag "B", and then use a check in the template to display or not display each widget based on roles. Reading through the issues here I see that it is mentioned that you can add the VUD widget to a page through the API, but I can't seem to find documentation on what function to call. I did see that you can adjust the position of the widget using the template, but this wouldn't allow me to add multiple widgets linked to separate tags.
Any suggestions?
Comments
Comment #1
marvil07 commentedYou can use conditional_fields to select the right field, but in order to have that completely functional you would need to have #1424432: Expose custom votingapi tags declared on vud_fields fixed first.
Comment #2
process91 commentedInstead what I ended up doing was using the VotingAPI results_alter hook to create two new role based aggregate functions, and then built a SQL query which groups the sums by roles to separate the two. Now they can use the same VUD widget, negating the need for two separate widgets (which was getting confusing anyway), and the separate aggregates get calculated as the votes are cast.
Thanks for your help and suggestions!