Hi,
Like so many others here - using this great module for other stuff, so trying to double it up as a voting system too...

Have already set up a + 1 vote system (binary state perfect for me) and views to display highest rated nodes.

I would like to:

- Give users 10 votes per 24 hours.

- After 24 hours, the system is refreshed (although voting numbers do not zero). They go back to having 10 votes, and they can use one of them on the same node as the day before if they really want to.

Is this possible with Flag? Could rules/actions give me this sort of time based behaviour?

Am I better off looking for this functionality else where?

Many thanks, great module,

Joe

Comments

quicksketch’s picture

Yes, this is possible with Flag by implementing an add-on module that implements hook_flag_access() and hook_flag_access_multiple(). In these functions you could query how many times the user has flagged in the last 24hours, if it's been more than 10 times on a particular flag, return FALSE and all the Flag links will be removed.

I might also suggest implementing a "global" token for "number of flags left", then you can add that token to your messages. Unless you want to trouble yourself with the JavaScript implementation, I'd also suggest turning off AJAX for that flag, then having your confirmation message be something like Thank you for flagging [title], you have [flags-remaining] flags remaining.

joecanti’s picture

Thanks for the reply quicksketch - very informative. I'm not a developer myself but I think I might try to find a developer to make this small add on module. Call it 'Flag Vote'. I'm guessing it wouldnt be too much work, but Im new to module creation so we'll see!

I might also try to build in a few features to do with voting, as I realise the voting stuff digresses away from the nature of the Flag module a little and it would be nice to get it into a separate mod. I'm thinking to incorporate trigger/actions so that when a flag is placed on a node, it is counted as a 'Flag Vote' by the new module and then unflagged automatically. This would allow the new module to handle multiple voting on the same nodes, and limited number of votes per user per day, feeding back messages to the user like '9 votes remaining today', or 'you've used up all of todays votes'.

I guess it would be a voting system using Flag for the link/user visibility/triggering etc, and a new module for counting/displaying/user control of voting...

Any thoughts??

Many thanks, Joe

mooffie’s picture

Status: Active » Closed (duplicate)

I'd also suggest turning off AJAX for that flag

feeding back messages to the user like [...] 'you've used up all of todays votes'.

These two issues are addressed by #952114: Have hook_flag_validate(). I'm marking this issue a duplicate.

Aditionally, Nate gave you some more tips.

This would allow the new module to handle multiple voting on the same nodes

Flag can already do this: when you're using a non-global flag, each user has his own "vote".

joecanti’s picture

The linked node sounds like a good addition to Flag, and nice that it can wrap up many issues - I'll keep an eye on the progress as it looks like it'll be very useful for voting systems.

Cheers, joe