Option to display votes in teaser

Boris Mann - September 11, 2005 - 06:11
Project:Voting
Version:4.6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:SoeL
Status:active
Description

This is a great module that does its job well. It would be great to include either the direct option to show the voting controls and/or vote totals in the teaser -- perhaps this could be shown in the links, like "4.5 vote average (345 votes)".

Users would still have to click "read more" for the voting controls and to actually vote.

If you don't want to add this feature, perhaps you could include a sample PHPTemplate snippet on how to work this in at the theme layer.

#1

benshell - September 13, 2005 - 02:36

That's a good idea. If you wanted the voting controls to show in the teaser exactly like it does on the node pages, it'd be easy to edit the voting_nodeapi() function to do that (and even add a display option for that in the voting settings). However, I think you're looking for a more flexible way of displaying the voting control. That wouldn't be hard if you don't mind editing the FLA file, but not everyone has Flash so I really should find a good way to do this without rebuilding the SWF file.

I'll have to think about this feature request and get back to you. Thanks for the input though!

#2

Boris Mann - September 13, 2005 - 03:48

Nope, I mean the easy one -- just give me plain-text links in the teaser :P

Advanced users can puzzle out the Flash on their own.

#3

shyam2053 - September 19, 2005 - 00:54
Version:HEAD» 4.6.x-1.x-dev

Hi

I would like this feature as well.

Not for the CVS version but Drupal 4.6.0

Thanks

#4

Isam Bayazidi - December 1, 2005 - 10:00

I had been trying to figure out how to make the voting appear with the teaser in the main pae (under each node) without any success. Things that I had tried include
- removing the if (!$teaser) for the case "view"
- adding $node->teaser = voting_control_node($node, $teaser, $page) . $node->teaser; and $node->teaser .= voting_control_node($node, $teaser, $page); for different positions of teh voting
- for the case "load" removing the if ($teaser) block

it's not working.. please advise on how to make the voting appear under each teaser in the main page view.

#5

SoeL - December 2, 2005 - 10:34
Assigned to:Anonymous» SoeL

To Isam Bayazidi
It's quite easy.
after

    case 'view':
      if (!$teaser) {
switch (variable_get('voting_location', 1)) {
case 0: // display above the node
$node->body = voting_control_node($node, $teaser, $page) . $node->body;
break;
case 1: // display below the node
$node->body .= voting_control_node($node, $teaser, $page);
break;
case 2: // do not display
}
      }

(in original votin.module rows 247-258) You should add following:

else {
switch (variable_get('voting_location', 1)) {
case 0: // display above the node
$node->teaser = voting_control_node($node, $teaser, $page) . $node->teaser;
break;
case 1: // display below the node
$node->teaser .= voting_control_node($node, $teaser, $page);
break;
case 2: // do not display
}
  }

#6

Andrew v2 - December 14, 2005 - 15:30

I have tried the addition of the code you've suggested above but I still cannot get the voting control to appear with the teaser in the main page. Do you have any idea why this might be? I'm using the 4.6.5 install with the 4.6.0 voting.module code. Thanks for your help.

#7

Isam Bayazidi - January 8, 2006 - 07:47

Same with Andrew, But I have 4.6.5. The suggested code by SoeL didn't work (in fact it was from what I tried before I post my previous comment). It seems that the teaser is created or manipulated after the hook run so the addition is lost. As well I read somewhere that the View op is only to alter the node body, and it didn't mention the teaser. Is it possible anyway ?

 
 

Drupal is a registered trademark of Dries Buytaert.