Posted by voxpelli on February 9, 2010 at 12:16pm
3 followers
| Project: | Plus 1 |
| Version: | 6.x-2.6 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I needed to be able to add additional conditions to determine whether voting should be allowed or not for a node - and I of course didn't like the idea of having to hack Plus1 to accomplish that.
I suggest adding a new hook, similar in design to hook_node_access(), that is used to determine when to show a widget and when to allow a vote.
That makes it possible for me to add extra conditions in my own module - I can for example say that all nodes not tagged with "Voting" shouldn't be voteable or say that all nodes contained added to a group should inherit a vote-setting from that group etc.
Attached is a patch that adds such a hook - "hook_plus1_access()".
| Attachment | Size |
|---|---|
| plus1_access_control.patch | 2.9 KB |
Comments
#1
First patch was missing the new plus1.api.php file - rerolling
#2
Hadn't tested the patch enough - sorry for that - reroll with fixes for typos etc.
#3
Very interesting idea - I like it a lot. However, isn't the standard type of return from hooks like this TRUE/FALSE?
#4
Hmm - yes - can't remember right now why I didn't use that. Might be to avoid mixups between NULL and FALSE perhaps.
I'm currently a bit tied up in trying to get OAuth 3.x stable - due to that I may not give very good response in this issue queue right now.
#5
That's okay. I think I have a pretty good number of the fixes ready to go.
#6
See fivestar_fivestar_access().
#7
This is ready to go.
#8
#9
Committed to 6.x-2.x-dev.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.