These 2 patches will make polls 'voteable' from the polls list. Clicking on a poll in the list will open it in the center block for voting if the poll is 'open for voting' and the voting member has permissions to do so, and hasn't voted already. If the poll is closed, the member doesn't have permission, or has already voted, the poll results are displayed. Also plugs up a backdoor hole that allowed a vote to be made to a closed poll.
Might want to tweak the pollblock.thtml template a bit to your liking as well.
Files:
{geeklog}/plugins/polls/functions.inc
{public_html}/polls/index.php
Text Formatted Code
--- functions.inc.orig 2007-11-16 02:21:13.000000000 -0600
+++ functions.inc 2007-11-16 02:22:36.000000000 -0600
@@ -909,7 +909,16 @@
$retval = strftime ($_CONF['daytime'], $A['unixdate']);
break;
case 'question':
- $retval = "<a href=\"{$_CONF['site_url']}/polls/index.php?qid={$A['qid']}&aid=-1\">$fieldvalue</a>";
+global $_TABLES;
+$zqid = $A['qid'];
+$zdisplay = DB_getItem ($_TABLES['pollquestions'], 'display',
+ "qid = '$zqid'");
+
+ if( POLLS_ipAlreadyVoted($zqid) || $zdisplay==0){
+ $retval .= "<a href=\"{$_CONF['site_url']}/polls/index.php?qid={$A['qid']}&aid=-1\">$fieldvalue</a>";
+} else {
+ $retval .= "<a href=\"{$_CONF['site_url']}/polls/index.php?qid=$zqid&aid=\">$fieldvalue</a>";
+}
break;
case 'access':
if ($access == 3) {
Text Formatted Code
--- index.orig 2007-11-16 01:01:39.000000000 -0600
+++ index.php 2007-11-16 01:04:42.000000000 -0600
@@ -146,6 +146,7 @@
// an aid greater than 0 will save a vote for that answer on the selected poll
// an aid of -1 will display the select poll
+$pdisplay = DB_getItem ($_TABLES['pollquestions'], 'display', "qid = '{$qid}'");
$display = '';
if (isset ($_POST['reply']) && ($_POST['reply'] == $LANG01[25])) {
@@ -174,6 +175,9 @@
}
}
}
+if ($pdisplay == 0) {
+ $aid = -1;
+ }
$order = '';
if (isset ($_REQUEST['order'])) {
$order = COM_applyFilter ($_REQUEST['order']);