I'm using most recent poll block to display polling in fronend. After i closed the poll, result is not showing. So how can i display the pol result in most recent block. Please any one help me out to fix that.

| improve this question | | | | |

Actually Poll module is making it to display only active poll as defined in these block

 * Implements hook_block_info().
function poll_block_info() {
  $blocks['recent']['info'] = t('Most recent poll');
  $blocks['recent']['properties']['administrative'] = TRUE;
  return $blocks;

 * Implements hook_block_view().
 * Generates a block containing the latest poll.
function poll_block_view($delta = '') {
  if (user_access('access content')) {
    // Retrieve the latest poll.
    $select = db_select('node', 'n');
    $select->join('poll', 'p', 'p.nid = n.nid');
    $select->fields('n', array('nid'))
      ->condition('n.status', 1)
      ->condition('p.active', 1)
      ->orderBy('n.created', 'DESC')
      ->range(0, 1)

    $record = $select->execute()->fetchObject();
    if ($record) {
      $poll = node_load($record->nid);
      if ($poll->nid) {
        $poll = poll_block_latest_poll_view($poll);
        $block['subject'] = t('Poll');
        $block['content'] = $poll->content;
        return $block;

As u can see this line in query ->condition('p.active', 1) it is causing these issue if u want u can remove this line and check,

But hacking core is not the right way in drupal better implement ur own block use the same code and make changes and display your block. Just implement ur own block by using same code base.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.