|
something that I hope others will find useful.
works for the latest version (8.05a)
basically its an update to the poll_display_inc.asp file.
what it does: the script changes the way polls work in the forum, so that you have to set an event date for when you want the poll results to be displayed.
The vote counts are hidden up until the calendar event, and then on that day the poll closes and shows just the results.
copy the code listed below and overwrite the poll_display_inc.asp file.
[code]
<% '**************************************************************************************** '** Copyright Notice '** '** Web Wiz Forums '** http://www.webwizforums.com '** '** Copyright ©2001-2006 Web Wiz. All Rights Reserved. '** '** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS UNDER LICENSE FROM 'WEB WIZ'. '** '** IF YOU DO NOT AGREE TO THE LICENSE AGREEMENT THEN 'WEB WIZ' IS UNWILLING TO LICENSE '** THE SOFTWARE TO YOU, AND YOU SHOULD DESTROY ALL COPIES YOU HOLD OF 'WEB WIZ' SOFTWARE '** AND DERIVATIVE WORKS IMMEDIATELY. '** '** If you have not received a copy of the license with this work then a copy of the latest '** license contract can be found at:- '** '** http://www.webwiz.net/license '** '** For more information about this software and for licensing information please contact '** 'Web Wiz' at the address and website below:- '** '** Web Wiz, Unit 10E, Dawkins Road Industrial Estate, Poole, Dorset, BH15 4JD, England '** http://www.webwiz.net '** '** Removal or modification of this copyright notice will violate the license contract. '** '**************************************************************************************** '** Poll votes hidden until event calendar date - Modified by Dean Clayton 2007 '****************************************************************************************
'Declare variables Dim strPollQuestion 'Holds the poll question Dim intPollChoiceNumber 'Holds the poll choice number Dim strPollChoice 'Holds the poll choice Dim lngPollChoiceVotes 'Holds the choice number of votes Dim lngTotalPollVotes 'Holds the total number of votes Dim dblPollVotePercentage 'Holds the vote percentage for the vote choice Dim blnAlreadyVoted 'Set to true if the user has already voted Dim blnMultipleVotes 'set to true if multiple votes are allowed Dim sarryPoll 'Array to hold the poll recordset Dim intPollCurrentRecord 'Hold the current postion in array
'Initlise variables blnAlreadyVoted = False intPollCurrentRecord = 0
'Get the poll from the database
'Initalise the strSQL variable with an SQL statement to query the database get the thread details strSQL = "SELECT " & strDbTable & "Poll.Poll_question, " & strDbTable & "Poll.Multiple_votes, " & strDbTable & "Poll.Reply, " & strDbTable & "PollChoice.Choice_ID, " & strDbTable & "PollChoice.Choice, " & strDbTable & "PollChoice.Votes " & _ "FROM " & strDbTable & "Poll" & strDBNoLock & ", " & strDbTable & "PollChoice" & strDBNoLock & " " & _ "WHERE " & strDbTable & "Poll.Poll_ID=" & strDbTable & "PollChoice.Poll_ID " & _ "AND " & strDbTable & "Poll.Poll_ID=" & lngPollID & ";"
'Query the database rsCommon.Open strSQL, adoCon
'If no record release rs If rsCommon.EOF Then 'Close recordsets rsCommon.Close
'If there is a poll then display it Else 'Read in the row from the db using getrows for better performance sarryPoll = rsCommon.GetRows() 'Close recordsets rsCommon.Close 'Initilise total votes lngTotalPollVotes = 0
'Read in the poll question strPollQuestion = sarryPoll(0,0) 'See if multiple votes are allowed blnMultipleVotes = CBool(sarryPoll(1,0)) 'See if this is a poll only blnPollNoReply = CBool(sarryPoll(2,0))
'Loop through and get the total number of votes Do While intPollCurrentRecord < (UBound(sarryPoll,2) + 1)
'Get the total number of votes lngTotalPollVotes = lngTotalPollVotes + CLng(sarryPoll(5,intPollCurrentRecord))
'Move to the next array position intPollCurrentRecord = intPollCurrentRecord + 1 Loop 'Reset array position intPollCurrentRecord = 0
'If multiple votes are not allowed see if the user has voted before If blnMultipleVotes = False Then
'Check the user has not already voted by reading in a cookie from there system 'Read in the Poll ID number of the last poll the user has voted in If CInt(Request.Cookies(strCookieName)("PID" & lngPollID)) = lngPollID OR CInt(getSessionItem("PID" & lngPollID)) = lngPollID Then blnAlreadyVoted = True End If
%><!-- Start Poll --> <form name="frmPoll" id="frmPoll" method="post" action="poll_cast_vote.asp<% = strQsSID1 %>"> <table class="tableBorder" align="center" cellspacing="1" cellpadding="3"> <tr class="tableLedger"> <td colspan="4"><% = strTxtPollQuestion %>: <% = strPollQuestion %></td> </tr> <tr class="tableTopRow"><%
'Display the vote choice slection column if the user CAN vote in this poll If blnVote = True AND blnForumLocked = False AND blnTopicLocked = False AND blnActiveMember = True AND blnAlreadyVoted = False Then
If (cdate(dtmEventDate)) > now() then%> <td width="3%"><% = strTxtVote %></td><% end if End If %> <td width="47%" nowrap><% = strTxtPollChoice %></td> <% If (cdate(dtmEventDate)) < now() then %> <td width="6%" align="center" nowrap><% = strTxtVotes %></td> <td widt
|