function advpoll_get_recent in Advanced Poll 7.2
Same name and namespace in other branches
- 7.3 advpoll.module \advpoll_get_recent()
- 7 advpoll.module \advpoll_get_recent()
1 call to advpoll_get_recent()
- advpoll_block_view in ./
advpoll.module - Implements hook_block_view().
File
- ./
advpoll.module, line 839
Code
function advpoll_get_recent() {
$node = NULL;
$result = db_query("SELECT n.nid FROM {node} n\n LEFT JOIN {field_data_advpoll_dates} d \n ON d.entity_id = n.nid \n LEFT JOIN {field_data_advpoll_closed} c\n ON c.entity_id = n.nid\n LEFT JOIN {field_data_advpoll_options} o\n ON o.entity_id = n.nid\n WHERE \n n.type LIKE '%advpoll%' AND\n o.advpoll_options_value <> 'electoral' AND\n n.status = 1 AND\n c.advpoll_closed_value = 'open' AND\n d.advpoll_dates_value < NOW() AND \n d.advpoll_dates_value2 > NOW() \n GROUP BY n.nid ORDER BY n.created DESC \n LIMIT 1");
if ($result) {
foreach ($result as $record) {
$node = node_load($record->nid);
break;
}
$rendered_node = node_view($node);
return drupal_render($rendered_node);
}
return $node;
}