You are here

function advpoll_latest_poll in Advanced Poll 6

Same name and namespace in other branches
  1. 5 advpoll.module \advpoll_latest_poll()
  2. 6.3 advpoll.module \advpoll_latest_poll()
  3. 6.2 advpoll.module \advpoll_latest_poll()

.

1 call to advpoll_latest_poll()
theme_advpoll_block_latest_poll in ./advpoll.module
Content of the block, as returned by advpoll_block('view').

File

./advpoll.module, line 282
Advanced Poll - a sophisticated polling module for voting, elections, and group decision-making.

Code

function advpoll_latest_poll() {
  $result = db_query('SELECT MAX(n.nid) AS nid FROM {node} n INNER JOIN {advpoll} p ON p.nid = n.nid WHERE n.status = 1 AND p.active = 1');
  $poll = db_fetch_object($result);

  // The nid will be NULL if there are no active polls.
  if ($poll->nid) {
    $node = advpoll_view(node_load($poll->nid), FALSE, FALSE);
  }
  return $node;
}