poll_load
- Versions
- 4.6 – 6
poll_load($node)- 7
poll_load($nodes)
Implementation of hook_load().
Code
modules/poll.module, line 240
<?php
function poll_load($node) {
// Load the appropriate choices into the $node object
$poll = db_fetch_object(db_query("SELECT runtime, polled, active FROM {poll} WHERE nid = %d", $node->nid));
$result = db_query("SELECT chtext, chvotes, chorder FROM {poll_choices} WHERE nid = %d ORDER BY chorder", $node->nid);
while ($choice = db_fetch_array($result)) {
$poll->choice[$choice['chorder']] = $choice;
}
// Determine whether or not this user is allowed to vote
$poll->allowvotes = false;
if (user_access('vote on polls')) {
if (!strstr($poll->polled, poll_uid())) {
$poll->allowvotes = $poll->active;
}
}
return $poll;
}
?>Login or register to post comments 