You are here

function votingapi_get_content_votes in Voting API 5

A helper function that returns an array of votes for one piece of content, keyed by the user who cast them.

Parameters

$content_type: A string identifying the type of content whose votes are being retrieved. Node, comment, aggregator item, etc.

$content_id: The key ID of the content whose votes are being retrieved.

Return value

An array of matching votingapi_vote records.

File

./votingapi.module, line 325

Code

function votingapi_get_content_votes($content_type, $content_id) {
  $votes = _votingapi_get_raw_votes($content_type, $content_id);
  $uid_keyed = array();
  foreach ($votes as $vote) {
    $uid_keyed[$vote->uid][] = $vote;
  }
  return $uid_keyed;
}