You are here

function votingapi_delete_vote in Voting API 5

Deletes a user's existing vote, if one exists.

Parameters

$vobj: A discrete $vote object, or minimally any object with a valid $vobj->vote_id

2 calls to votingapi_delete_vote()
votingapi_delete_votes in ./votingapi.module
Deletes a collection of vote objects.
votingapi_unset_vote in ./votingapi.module
Deletes all votes cast on a particular content-object by a user. In most cases, this is the function that should be used by external modules.

File

./votingapi.module, line 233

Code

function votingapi_delete_vote($vobj) {
  if (!(isset($vobj->content_type) && isset($vobj->content_id))) {
    $vobj = votingapi_get_vote_by_id($vobj->vote_id);
  }
  votingapi_invoke('delete', $vobj);
  db_query("DELETE FROM {votingapi_vote} WHERE vote_id=%d", $vobj->vote_id);
}