You are here

function _votingapi_prep_vote in Voting API 6.2

Same name and namespace in other branches
  1. 6 votingapi.module \_votingapi_prep_vote()
  2. 7.2 votingapi.module \_votingapi_prep_vote()

Populate the value of any unset vote properties.

Parameters

$vote: A single vote.

Return value

A vote object with all required properties filled in with their default values.

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 561
A generalized voting API for Drupal.

Code

function _votingapi_prep_vote(&$vote) {
  global $user;
  if (empty($vote['prepped'])) {
    $vote += array(
      'content_type' => 'node',
      'value_type' => 'percent',
      'tag' => 'vote',
      'uid' => $user->uid,
      'timestamp' => time(),
      'vote_source' => ip_address(),
      'prepped' => TRUE,
    );
  }
}