Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 Poll Mod - Everyone votes
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

jamesdavis
Starting Member

USA
26 Posts

Posted - 07 August 2005 :  12:48:07  Show Profile  Visit jamesdavis's Homepage
It appears to me that the 'Allow everyone to vote' capability is coded backwards.

In the distribution the inc_func_common.asp modification starting in line 107 is:


  if strWhoVotes = "members" then	'### Members Only Mode
  '## Insert vote into POLL_VOTES table
  '############# Poll Mod Update 2.0.4 -> 2.0.5 ############
  ' Change strMemberTablePrefix -> strTablePrefix
    strSql = "INSERT INTO " & strTablePrefix & "POLL_VOTES  (GUEST_VOTE, MEMBER_ID, TOPIC_ID, FORUM_ID, CAT_ID)" & _
		"VALUES (" & pGuest_Vote & ", " & pMember_ID & ", " & pTopic_ID & ", " & pForum_ID & ", " & pCat_ID & ")"
  '#####################
  '#########################################################
   my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
  '############# Poll Mod Update 2.0.3 -> 2.0.4 ############
  else '### Everyone Can Vote Mode
   '#########################################################
   if mlev > 0 then
   '## Insert vote into POLL_VOTES table
   '############# Poll Mod Update 2.0.4 -> 2.0.5 ############
   'Change strMemberTablePrefix -> strTablePrefix
	strSql = "INSERT INTO " & strTablePrefix & "POLL_VOTES (GUEST_VOTE, MEMBER_ID, TOPIC_ID, FORUM_ID, CAT_ID)" & _
	"VALUES (" & pGuest_Vote & ", " & pMember_ID & ", " & pTopic_ID & ", " & pForum_ID & ", " & pCat_ID & ")"
   '#########################################################


This coding does NOT record guest votes.

The first 'If' should be changed to:
if strWhoVotes = "everyone" then '### Everyone can vote

The 'else' line comment should be changed to:
else '### Members only can Vote

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 08 August 2005 :  00:09:31  Show Profile
You probably don't understand what the code is doing. If the poll is set to "Members only" strWhoVotes = "members", then it records the vote in the database along with the member id of the person voting.

If the poll is set to "Everybody can vote", which is the code after the else, it does 2 more checks: to check if the members is logged in, or if the person is logged out (or just non-registered user).

- if the member is logged in, and the poll is set to "Everybody can vote" then it stores the vote in the database and set a cookie on users computer.

- if the person is logged out (or a non-registered user) it only sets a cookie on the computer.

But lets start at the beginning. Why do you think there is a problem with the code?

Support Snitz Forums

Edited by - Davio on 08 August 2005 00:16:32
Go to Top of Page

jamesdavis
Starting Member

USA
26 Posts

Posted - 08 August 2005 :  08:13:25  Show Profile  Visit jamesdavis's Homepage
Please note that I did not claim that guest votes were not counted - only that they were not being recorded. Guest votes were not reliably being recorded (but were properly counted) on my board despite my having set StrWhoVotes to "everyone".

The code I posted in my message is your distribution code in the inc_func_common.asp program. You will notice that if strWhoVotes is set to "members" the POLLS_VOTES db has a record inserted regardless of the mlev setting (member or not) while if it is set to "everyone" ONLY member votes are inserted into that db. That is the problem I reported. I set strWhoVotes to "everyone" and only member votes were being recorded in POLL_VOTES.

I have modified POLL_VOTES by adding the actual vote cast in order to facilitate being able to do cross-poll analysis.



Respectfully,

James R. Davis

Edited by - jamesdavis on 08 August 2005 08:15:41
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 08 August 2005 :  17:30:50  Show Profile
quote:
You will notice that if strWhoVotes is set to "members" the POLLS_VOTES db has a record inserted regardless of the mlev setting (member or not)
You are quite right. There is no check for the members level when the poll is set to Members Only.

But it shouldn't be possible for a non-registered user to vote in a Members Only poll. If a non-registered user tried to vote in a Members Only poll, there is a check to see if they are logged in, and an error message shown.

That's not what your problem is about though. You're saying guest votes are counted, but not recorded. But I'm not sure what you mean by that. If a non-registered user votes in a poll, the only thing that needs to be done is to increase the poll vote by 1 and store a cookie on the users computer, to prevent them from voting again.

The FORUM_POLL_VOTES table records the votes by members only.

Support Snitz Forums
Go to Top of Page

jamesdavis
Starting Member

USA
26 Posts

Posted - 08 August 2005 :  22:06:09  Show Profile  Visit jamesdavis's Homepage
Thank you. By the way, your coding in this mod is supurb!

As I indicated, I extended the POLL_VOTES table to record the actual vote. I do this for both members and guests. It is for that reason that I could create multi-colored (guest and Member voted shown differently) results presentations.

Poll without guests example:
http://www.msgroup.org/forums/mtt/images/pollwoguests.jpg

Poll with guests example:
http://www.msgroup.org/forums/mtt/images/pollwguests.jpg

To do this I had to record guests as well as member votes in POLL_VOTES.

Edited by - jamesdavis on 08 August 2005 22:09:08
Go to Top of Page

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 09 August 2005 :  01:29:17  Show Profile
Ohhhhhhh, I see. That is very cool.

So the change you're submitting in your original post, is needed to accomodate your modification to the mod. Not a bug in the poll mod.

Support Snitz Forums
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07