The module has only one block for the last poll. It would be very nice if it also had a block, which would circulate all the active polls on page refresh. Thus, every time user visits a page she could see and be able to participate in different polls.

CommentFileSizeAuthor
#2 advpoll.patch15.42 KByngens

Comments

acushla’s picture

Me too :)

yngens’s picture

StatusFileSize
new15.42 KB

I have done almost all the job to get second block for random polls to the module. Need just a little help. I have checked - DB request is the right one, but besides DB request I needed to modify the modules code at several different places. And something not working.

I can't figure out the right code for, and I am afraid my mistake is here, hook_theme:

Original:

/**
 * Implementation of hook_theme().
 */
function advpoll_theme() {
  return array(
    'advpoll_page' => array('arguments' => array('' => '')),
    'advpoll_block_latest_poll' => array('arguments' => array()),
    'advpoll_results' => array('arguments' => array('title' => '', 'results' => '', 'votes' => '', 'links' => '', 'nid' => '', 'voted' => '', 'cancel_vote' => '')),
    'advpoll_bar' => array('arguments' => array('title' => '', 'percentage' => '', 'votes' => '', 'choice' => NULL)),
    'advpoll_voting_ranking_form' => array('template' => 'advpoll-display-ranking-form', 'file' => 'modes/ranking.inc', 'arguments' => array('form' => NULL)),
  );
}

Modified:

/**
 * Implementation of hook_theme().
 */
   
function advpoll_theme() {
  return array(
    'advpoll_page' => array('arguments' => array('' => '')),
    'advpoll_block_latest_poll' => array('arguments' => array()),
    'advpoll_results' => array('arguments' => array('title' => '', 'results' => '', 'votes' => '', 'links' => '', 'nid' => '', 'voted' => '', 'cancel_vote' => '')),
    'advpoll_bar' => array('arguments' => array('title' => '', 'percentage' => '', 'votes' => '', 'choice' => NULL)),
    'advpoll_voting_ranking_form' => array('template' => 'advpoll-display-ranking-form', 'file' => 'modes/ranking.inc', 'arguments' => array('form' => NULL)),
  );
 return array(
    'advpoll_page' => array('arguments' => array('' => '')),
    'advpoll_block_random_poll' => array('arguments' => array()),
    'advpoll_results' => array('arguments' => array('title' => '', 'results' => '', 'votes' => '', 'links' => '', 'nid' => '', 'voted' => '', 'cancel_vote' => '')),
    'advpoll_bar' => array('arguments' => array('title' => '', 'percentage' => '', 'votes' => '', 'choice' => NULL)),
    'advpoll_voting_ranking_form' => array('template' => 'advpoll-display-ranking-form', 'file' => 'modes/ranking.inc', 'arguments' => array('form' => NULL)),
  );
      
}

Please, see the patch.

vood002’s picture

Why not just use views? Pretty simple to set up a view that will do this.

yngens’s picture

Can't get polling bars displayed in a view block. I can pull up random polls subject, ccks - all the node related fields, but not the poll's content itself.

Turns out advanced poll and views integration is not complete: http://drupal.org/node/301834

So, please review my patch to include second block to the module by default. Some users might want to use random poll without activating views, even after integration of two modules will be complete.

yngens’s picture

any news on this? views does not allow display poll bars. So it would be very nice if the module could provide two blocks originally.

Vector-’s picture

Unless I'm missing something, you should be able to set the view to display full nodes, and it will display the polling bars etc, I think?
You could then make that view a block and get what you're looking for, I believe.

If you do actually want to use the poll content as a field... I think it should be available in the node object, you could try something like a Views Customfield...
I think the PHP Customfield would go something like this:
print $data->content['poll']['#value'];

Loading the entire node as a field with Views Nodefield should work too...

And I actually used DisplaySuite to accomplish this, personally, with a custom build mode... but I use DS extensively, it would be a rather heavy solution for just a poll block.
PS: the DS Field code is the above PHP snippet with $object in place of $data, in case anyone cares.

yngens’s picture

Tank you Vector, had to go with display a full node, though it is not as comfortable as just ordinary block would be.

robato’s picture

I wish Drupal just had the random poll option right in the poll module. What website, that has polls, doesn't do random poll blocks on their site? (its hugely common!)

At any rate, I did what Vector said and it works. I do appreciate it. However now the polls show up as hyperlinks that link back to the poll node and other fields, such as my taxonomy tags, show up in the block too. I would throw in a tpl file to get rid of those fields and strip the anchor tags, but it seems there is no tpl for showing a whole node only rows. Could someone tell me what I need to do? Thanks!

*edit*
By the way, I just realized this is issues in "advanced poll" module. Im not using this module, Im using Drupal 7. I probably should have posted my problem in here, but I found my solution in here.

gobinathm’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

D6 is EOL hence this issue won't be fixed (or) attended. So closing it.