You are here

function votingapi_delete_votes in Voting API 6.2

Same name and namespace in other branches
  1. 5 votingapi.module \votingapi_delete_votes()
  2. 6 votingapi.module \votingapi_delete_votes()
  3. 7.2 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.

1 call to votingapi_delete_votes()
votingapi_set_votes in ./votingapi.module
Cast a vote on a particular piece of content.

File

./votingapi.module, line 289
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'];
    }
    db_query("DELETE FROM {votingapi_vote} WHERE vote_id IN (" . db_placeholders($vids) . ")", $vids);
  }
}