Project:Fivestar
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

Hi There,

maybe I didn't found the right place to set this up, but what I need is to enable or disable rating during editing a single node.
What I did is to enable rating to a specific node-type, but I did not mean to enable it to all nodes of that type, what actually happened.

Here's my question: Is there a possibillity to disable and enable rating on specific nodes only?

Thanks for your replies - Andreas

Comments

#1

*get this out uf the trashcan and put it back to top*

Hey, I really need some advice here. I can't believe that nobody had that problem before...

#2

Same problem here. Most nodes of one node type should have the widget, but some should not have a fivestar widget. So i am also searching for a solution.
Putting it in a block is a possibility but then you cant change the labels

#3

Nodody???

#4

Title:Individual enabling of Rating per Node not per Node-Type» Enable/Disable Rating per Node
Category:support request» feature request

Marked #386876: Display fivestar on certain book pages as duplicate.

Here's my question: Is there a possibillity to disable and enable rating on specific nodes only?

No this currently is not possible other than doing some work in the theme layer (build a list of nodes to show on, then unset() the Fivestar display before output for all other nodes). Right now all nodes within the entire content type become ratable when Fivestar is enabled on that type. I'm moving this to a feature request.

#5

Great, thanks a lot. solving that via theming is an idea too, but looks like it is not the "drupal way" isn't it?

Therefor I'll wait for the official solution :-)

regards - andreas

#6

Version:6.x-1.13» 6.x-2.x-dev

#162183: Allow selective suppression of voting on selected nodes of a particular type looks like another duplicate.

I need this for a project so am pondering the best way to go about it.
Why not integrate with flag module? IIRC flag module has an API for modules to define flags. Just define a global flag on nodes called 'votable'. We then get all of flag module's integration with views, actions, etc for free, and a nice UI too.

Bumping the version.

#7

I agree with all of the above. It would be great to see an option to enable/disable ratings per node, just like comments.

#8

subscribing.

I was trying to figure out a way to have ratings for individual songs and then the entire album. But I can't seem to find a way to add the rating system to the node's page. That would be a sweet option.

#9

I marked #162183: Allow selective suppression of voting on selected nodes of a particular type as a duplicate. timofey has the right idea in #7. This will be implemented as a toggle option on the node edit form, just like comments.

I might have a need for this on a new site, so this might finally get put together. Everyone who's wondering "why isn't this done?" is because no one has put any effort into it. If you want it sooner, hire a developer or do it yourself and file a patch.

#10

Component:Documentation» Code
Status:active» needs review

I needed this feature. So I started to put some work into this. I've extended the fivestar code a bit and poured my work into a patch.

What I added:

* Five star as a node field: added a seperate table which keeps an enabled flag per node.
* Five star as a CCK field: added an extra 'enabled' option which should be kept per node.

First time I really tinkered around with the CCK Field API (I like it! :D) so I've probably done some horrible things (i.e. unsetting $items on the 'sanitize' op in hook_field). Furthermore, it still lacks support for fivestar-as-a-block and I think a Fivestar enabled Views filter wil be in order.

But so far: it looks like it works in a very basic fashion and I would like some feedback early on how to improve this.

AttachmentSizeStatusTest resultOperations
enabledisable.patch6.07 KBIgnored: Check issue status.NoneNone

#11

Hi there,

Thanks for the patch! The node field setting seems to work on my site, but only for nodes that were created after installing this patch. Any way to enable voting on previous nodes too?

Thanks a lot!

#12

Thanks for the patch.

#13

Again great patch and I hope it is used on later releases. Nevertheless, when I use modules like modr8 and rebuild permissions I get these errors (see below) when a non-admin user checks out the site.

user warning: Column 'nid' in where clause is ambiguous query: SELECT f.nid, f.enabled FROM fivestar_node f LEFT JOIN node n ON f.nid = n.nid WHERE ((n.moderate != 1 OR n.uid = 3)) AND ( nid = 150) in
...\sites\all\modules\fivestar\fivestar.module on line 929.
user warning: Column 'nid' in where clause is ambiguous query: SELECT f.nid, f.enabled FROM fivestar_node f LEFT JOIN node n ON f.nid = n.nid WHERE ((n.moderate != 1 OR n.uid = 3)) AND ( nid = 140) in
C...\sites\all\modules\fivestar\fivestar.module on line 929.

#14

Hi, what I did is created a new page content type called Page-NotRated. This way my pages that were already created would keep the fivestar rating, but I could make future pages that weren't supposed to have ratings on it. I have an example of it if you go to http://funfreegameshq.com/FlashGames/Submachine You'll notice that there is no game rating for it on that page, but if you go to each of the game pages it has the Fivestar rating. I hope this helps someone :) Take care!
-mike

#15

Status:needs review» needs work

Thanks for the initial work. We might be needing this functionality so I thought I'd offer some comments about changes I'd make before using it.

1.) I'd change the fivestar_node table to a single column table that only holds node ids where fivestar is disabled. (Obviously with a Primary Key on the nid column). This semantic change would obviously require other changes I won't bother to detail.
2.) Avoid using regular expressions when possible. Change

if (preg_match('/_node_form$/', $form_id)) {

to something more like
if ($form['type']['#value'] .'_node_form' == $form_id) {

3.) There is some commented out cruft code
+    //fivestar_node_delete($node);

Other than those changes, this is the model I'd have taken to implement this.

#16

I'd really like this feature as well. I'm not sure if this patch will still work with the current dev version of fivestar, but I'm going to give it a shot.

I also plan to add rules integration to this patch by adding 'enable voting' and 'disable voting' on certain events.

Are there any plans to implement this into the module?

#17

I took rmjiv's suggestions and modified the patch from #10. It's currently working on my site with Fivestar 1.19. I have found one bug with it-- enabling both fivestar cck and normal fivestar on the same content type will cause issues.

Looking back... it was foolish to to roll this against the 2.x version. Maybe someone can help to clean this up or adapt it? It's a very helpful feature.

AttachmentSizeStatusTest resultOperations
disable_by_node-336365-16.patch26.23 KBIgnored: Check issue status.NoneNone

#18

I have to wonder, how many people actually want this feature?

I personally don't like it, and feel that this is a very specific use case that can be solve with very little php in the tpl.

#19

How do you suggest accomplishing this in the tpl? Just hiding the rating field?

#20

@madmatter23 you can set up an int field with the options show/hide fivestar. On the node tpl you can hide/show the fivestar field based on the value of that field. Also this feature with the hide/show fivestar can easily be packages up into a feature to show how this can be done. I would much rather just link to a feature module hosted in a sandbox or a feature server instead of adding all this to fivestar.

It just seems theres way to much in that patch.

Also there seems to be references to a fivestar_rules.inc , not sure what that is about.

#21

Hm, you're approach is much simpler. I may have gotten overly excited when seeing a patch in #10 that did exactly what I needed. Great suggestion.

I had added a rules trigger to enable/disable the fivestar widget on specific nodes via rules, but the cck int method that you suggested would easily replace this-- I can just change the int value for the cck field in rules.

Thanks for your time and patience!

#22

If there truly isn't enough interest in the feature to make it worth supporting, I understand not adding a patch to the Fivestar module.

That said, I strongly disagree that adding a CCK field and editing node template TPL files is better or simpler. It breaks any attempt at encapsulation and separation of concerns. And the module has gone to the trouble to build the display only to have it discarded at the last moment.

If the answer from the maintainers is "Won't Fix", can we at least get an access check or hook so that those of us who do need this ability can implement it cleanly?

Thanks.

#23

Status:needs work» closed (won't fix)

I have no problem adding a permission check #221181: Implement View Ratings permission but thats about it,

I hook would be a bit overkill don't you think? The render api already allows you to modified the data, how you implement the settings to show/hide is up to you.

I recommended cck int value as a simple case but you're welcome to do what ever you wish.

Any other recommendation welcome? Also note, you you can complete control how/when the fivestar widget is display, so if you wish to render it only when certain conditions are met thats also possible. If you run into any problems with this approach feel free to open a bug as an API issue and I'll fix it.

Hope this helps :)

nobody click here