News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Mod to enable guests to vote in polls

Started by Placeman, August 22, 2005, 08:42:42 PM

Previous topic - Next topic

Placeman

Is there a mod...or if not, would it be tough for someone to code a mod that would allow guests to participate in polls?

I understand that the results could get skewed a bit.  I'm talking about polls like what you see on news sites.  You could have it check a cookie to see if you have voted already and if so, disallow you from voting again.  Sure, they could clear the cookie or use another machine and vote again, but like I said, these polls would not be scientific.  If I wanted a scientific poll, I would post it in a board that would be viewable only to registered users.

Thanks.

dtm.exe

Change guests' permissions to allow them to vote in polls.  It's there with 1.1, not sure about 1.0.5.

-Dan The Man

[Unknown]

Quote from: OIDanTheManIO on August 22, 2005, 08:45:11 PM
Change guests' permissions to allow them to vote in polls.  It's there with 1.1, not sure about 1.0.5.

-Dan The Man

No it isn't.  If it is there, that's a bug.

-[Unknown]

dtm.exe

Quote from: [Unknown] on August 22, 2005, 08:51:34 PM
No it isn't.  If it is there, that's a bug.

-[Unknown]

Sorry, my mistake.  Guests can create polls, lock polls, etc. but not vote in them.  Soory about that.

-Dan The Man

guymal

Any news on this?
I need a way for guests to be able to vote in polls.

ディン1031

Quote from: guymal on August 29, 2005, 11:45:13 AM
Any news on this?
I need a way for guests to be able to vote in polls.
I think the greatest problem there is to find out, did the guest already post...
and another thing is there a lot of changes to do so that guest can make a poll klick :x.

Why do you not use for this some other skripts like this -> http://www.phpwelt.de/archiv/arcscript.php?arcid=335
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

guymal

Well all my users are already using the forum so it's kinda weird not to use the built in poll mechanism.

Why can't we just set a cookie (with a unique poll id) once somebody has voted?
If somebody REALLY wants to vote several times and erases the cookie...fine, this isn't the presidential election here.

kspeaks

Quote from: Placeman on August 22, 2005, 08:42:42 PM
Is there a mod...or if not, would it be tough for someone to code a mod that would allow guests to participate in polls?

I understand that the results could get skewed a bit.  I'm talking about polls like what you see on news sites.  You could have it check a cookie to see if you have voted already and if so, disallow you from voting again.  Sure, they could clear the cookie or use another machine and vote again, but like I said, these polls would not be scientific.  If I wanted a scientific poll, I would post it in a board that would be viewable only to registered users.

Thanks.

With the following revisions, I was able to implement Guest voting.  The change to ManagePermissions.php is purely cosmetic but the other changes included are required.  Good luck!








diff original/Sources/ManagePermissions.php modified/Sources/ManagePermissions.php

1038c1038
<               'poll_vote',
---
>       //      'poll_vote',








diff original/Sources/Poll.php modified/Sources/Poll.php
81,82c81,82
<       if ($user_info['is_guest'])
<               fatal_lang_error('cannot_poll_vote');
---
> //    if ($user_info['is_guest'])
> //            fatal_lang_error('cannot_poll_vote');
93a94
>
166,169c167,175
<       db_query("
<               INSERT INTO {$db_prefix}log_polls
<                       (ID_POLL, ID_MEMBER, ID_CHOICE)
<               VALUES $setString", __FILE__, __LINE__);
---
>         if (!$user_info['is_guest'])
>       {
>               // do not log guest votes, only count
>               db_query("
>                       INSERT INTO {$db_prefix}log_polls
>                               (ID_POLL, ID_MEMBER, ID_CHOICE)
>                       VALUES $setString", __FILE__, __LINE__);
>       }
>
178c184,185
<       redirectexit('topic=' . $topic . '.' . $_REQUEST['start']);
---
>       redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . ";viewResults");








diff original/Sources/Display.php modified/Sources/Display.php
467c467,468
<               $context['allow_vote'] = !$context['poll']['is_expired'] && !$user_info['is_guest'] && !isset($_REQUEST['viewResults']) && empty($pollinfo['votingLocked']) && allowedTo('poll_vote') && !$context['poll']['has_voted'];
---
>               $context['allow_vote'] = !$context['poll']['is_expired'] && !isset($_REQUEST['viewResults']) && empty($pollinfo['votingLocked']) && allowedTo('poll_vote') && !$context['poll']['has_voted'];


Ambasador


Advertisement: