function _votingapi_prep_vote in Voting API 7.2
Same name and namespace in other branches
- 6.2 votingapi.module \_votingapi_prep_vote()
- 6 votingapi.module \_votingapi_prep_vote()
Populate the value of any unset vote properties.
Parameters
$vote: A single vote.
2 calls to _votingapi_prep_vote()
- votingapi_add_votes in ./
votingapi.module - Save a collection of votes to the database.
- votingapi_set_votes in ./
votingapi.module - Cast a vote on a particular piece of content.
File
- ./
votingapi.module, line 663 - A generalized voting API for Drupal.
Code
function _votingapi_prep_vote(&$vote) {
global $user;
if (is_array($vote) && empty($vote['prepped'])) {
$vote += array(
'entity_type' => 'node',
'value_type' => 'percent',
'tag' => 'vote',
'uid' => $user->uid,
'timestamp' => REQUEST_TIME,
'vote_source' => hash('sha256', serialize(ip_address())),
'prepped' => TRUE,
);
}
}