function votingapi_delete_votes in Voting API 6
Same name and namespace in other branches
- 5 votingapi.module \votingapi_delete_votes()
- 6.2 votingapi.module \votingapi_delete_votes()
- 7.2 votingapi.module \votingapi_delete_votes()
Delete votes from the database.
Parameters
$votes: An array of vote objects to delete. Minimally, each object must have the vote_id property set.
1 call to votingapi_delete_votes()
- votingapi_set_vote in ./
votingapi.module - Cast a vote on a particular piece of content. If a vote already exists, its value is changed. In most cases, this is the function that should be used by external modules.
File
- ./
votingapi.module, line 242
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 (" . implode(',', array_fill(0, count($vids), '%d')) . ")", $vids);
}
}