You are here

function votingapi_delete_votes in Voting API 7.2

Same name and namespace in other branches
  1. 5 votingapi.module \votingapi_delete_votes()
  2. 6.2 votingapi.module \votingapi_delete_votes()
  3. 6 votingapi.module \votingapi_delete_votes()

Delete votes from the database.

Parameters

$votes: An array of votes to delete. Minimally, each vote must have the 'vote_id' key set.

3 calls to votingapi_delete_votes()
MigrateDestinationVotingApiVote::bulkRollback in ./votingapi.migrate.inc
Delete the provided votes and recalculate the results.
votingapi_set_votes in ./votingapi.module
Cast a vote on a particular piece of content.
_votingapi_delete_votes_by_entity in ./votingapi.module
Helper function to delete all votes on given entities.

File

./votingapi.module, line 363
A generalized voting API for Drupal.

Code

function votingapi_delete_votes($votes = array()) {
  if (!empty($votes)) {
    module_invoke_all('votingapi_delete', $votes);
    $vids = array();
    foreach ($votes as $vote) {
      $vids[] = $vote['vote_id'];
    }
    $function = variable_get('votingapi_storage_module', 'votingapi') . '_votingapi_storage_delete_votes';
    $function($votes, $vids);
  }
}