I wanted to set up a 'book page' hierarchy where a few nodes were essentially containers for many leaf nodes. I wanted voting allowed on all the leaf book pages but not on the containers. Of course I could have created two different node types but then I loose the ability to fully use the existing book class.
So, after using the normal fivestar configuration to set voting on all book pages I modified the fivestar.module code to place a 'Suppress voting on this page' option on the individual node edit pages. Any pages for which this option is set then skip the presentation of a voting form in their view modes.
The result is voting on all nodes of the specified type EXCEPT for those nodes for which it is specifically suppressed.
I have available code to implement this feature if it is of interest to anyone else.
Comments
Comment #1
john morahan commentedDo you still have this code? If so, would you mind posting it here? I'm looking for exactly what you described.
Comment #2
fronbow commentedme too.
At the moment I'm doing thru' the theme, so I have to update it everytime I have a url I don't want to use it at!
Comment #3
greg.harveyBUMP!!
Where are you billirl?? It would be awesome if you could publish back what you did for the community to review. I suspect this would be a popular feature. =)
Comment #4
btmash commentedAck...I remember doing something similar for a project I did a while ago. I'll find it and try to give the patch tomorrow morning :)
Comment #5
greg.harveyOoo, that would be great! =)
Comment #6
btmash commentedAck...I found the code...but it was on an old version of fivestar (5.x-1.4)...no install file or anything at the time. I can see there are a fair number of changes since then as well :( Any ideas on the best way to have a patch?
Comment #7
greg.harveyHmmm, tricky. The patch won't apply itself to the latest version. I don't think there is an easy way. But if the thinking is done then re-writing the code should be easier. If it's a proper patch file then it should show you which lines it replaced and you should be able to find the equivalent lines in a clean copy of Fivestar 5.x-1.7, edit it and recreate the patch.
If you post the old patch here, I will take a look when I get a chance - probably at some point in April I'll have time. If you don't have a patch, then post your version of fivestar.module with the modifications, I'll download Fivestar 5.x-1.4 from the archive and build a patch file as a starting point. =)
Comment #8
btmash commentedI initially thought of just adding the patches to drupal-5-x-dev but I have no idea which version is the dev (Drupal-5 or Drupal-5-11?) I'm just appending the code below (I didn't add the checks to display the node that should be there in hook_view or hook_block as we did that check in the theme but you can see its easy enough to add) The pieces of code that I had were:
(In fivestar.module as new functions):
(As part of hook_menu):
And finally in hook_install():
Comment #9
btmash commentedOne thing I'd like to add is you could add checks for
fivestar_object_allowed($nid)in hook_view, hook_block, and fivestar_widget_form (since some of them show titles and other sets of info so this would be a way to hide it from all 3 areas) though others here might have a better idea on the best places to perform the check.Comment #10
quicksketchI'd much rather make this an option on the node edit form than a link displayed on the node. This unfortunately should also use a separate database table rather than using a single variable per node type.
Comment #11
btmash commentedThe link portion of it could be on either part - however, it does use a separate database table (which simply stores the node id - so if it sees the node id is in the fivestar_exceptions table, then the form should not be displayed on the page.
Comment #12
greg.harveyMe too, re: node edit form. But this is great, BTMash. Thanks so much for sharing. =)
Comment #13
btmash commentedRegarding the node edit form versus a link, I remember trying out both ways at my workplace with most of the others around me preferring to use the link (so if they saw it on a page they felt didn't need it, it could be removed without going to the node edit page) - I preferred the node edit way but chalked it up to not understanding the main users around me >_<
Comment #14
quicksketchI'm marking this duplicate of #336365: Enable/Disable Rating per Node, since seeing "BUMP!!" in any issue immediately makes me not ever want to fix the issue because it ticks me off so much. This solution will not be implemented as link and will be a node-form option, just like enabling/disabling comments.
Comment #15
greg.harvey1. Thanks for putting this feature in.
2. I'm really sorry if my post annoyed you, but be fair, take the "bump" in context... It feels like you saw the word and the red mist came down - you didn't read the comment at all:
It's 100% clear I'm a) not pestering the maintainer, but trying to continue a conversation with another developer and encouraging them to post code they'd already written - see opening post, not write stuff for me and b) not shouting about an open issue like some people do (which, I agree as a module maintainer myself, can be annoying...)
Anyway, good to see the feature in.