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()".

Comments

voxpelli’s picture

StatusFileSize
new4.43 KB

First patch was missing the new plus1.api.php file - rerolling

voxpelli’s picture

StatusFileSize
new5.07 KB

Hadn't tested the patch enough - sorry for that - reroll with fixes for typos etc.

nancydru’s picture

Very interesting idea - I like it a lot. However, isn't the standard type of return from hooks like this TRUE/FALSE?

voxpelli’s picture

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.

nancydru’s picture

That's okay. I think I have a pretty good number of the fixes ready to go.

nancydru’s picture

See fivestar_fivestar_access().

nancydru’s picture

This is ready to go.

nancydru’s picture

Status: Needs review » Patch (to be ported)
nancydru’s picture

Status: Patch (to be ported) » Fixed

Committed to 6.x-2.x-dev.

Status: Fixed » Closed (fixed)

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