VotingAPI is a flexible, easy-to-use framework for rating, voting, moderation, and consensus-gathering modules in Drupal. It allows module developers to focus on their ideas (say, providing a 'rate this thread' widget at the bottom of each forum post) without worrying about the grunt work of storing votes, preventing ballot-stuffing, calculating the results, and so on.
VotingAPI does four key jobs for module developers:
- CRUD: Create/Retrieve/Update/Delete operations for voting data. The simplest modules only need to call two functions -- votingapi_set_vote() and votingapi_get_voting_results() -- to use the API. Others can use finer-grain functions for complete control.
- Calculation: Every time a user casts a vote, VotingAPI calculates the results and caches them for you. You can use the default calculations (like average, total, etc) or implement your own custom tallying functions.
- Workflow: By integrating with Actions.module, VotingAPI can trigger workflow steps (like promoting a node to the front page, hiding a comment that's been flagged as spam, or emailing an administrator) when votes are cast and results are tallied. Modules can expose their own 'default' action sets and filter criteria to provide moderation and promotion systems.
- Display: VotingAPI integrates with Views.module, allowing you to slice and dice your site's content based on user consensus. It also provides convenience functions to format vote data for display to users.
If you're a Drupal user looking for a voting or rating module (rather than just a framework), or you're a developer looking for examples of VotingAPI based code, check out some of the following projects:
Modules that are no longer actively maintained (may be easy to update and have interesting ideas on how to write a VotingAPI module):