PDA

View Full Version : Limit the poll selection.


limgeorge
11-11-2002, 09:35 PM
If I have 10 options in a poll, and I want to limit the users to only vote 3 options out of the 10 options per user. How can I do it? Is there a hack out there for it or can some guru create a hack like that?

Xenon
11-12-2002, 04:30 PM
in your poll.php you'll find that:

if ($pollinfo['multiple']) {
$insertsql = "";
while (list($val, $vote)=each($optionnumber)) {
if ($vote == "yes") {
if ($insertsql) {
$insertsql .= ",";
}
$insertsql .= "('$pollid','$ourtimenow','$val','$bbuserinfo[userid]')";
}
}


add below it:

if(substr_count($insertsql,"(")>3) {
eval("standarderror(\"You can just vote 3 options.\");");
}

limgeorge
12-13-2002, 12:02 AM
Thanks

Xenon
12-14-2002, 10:08 PM
oh, long time since then ;)

but you're welcome ;)

Carsten
01-01-2003, 07:50 PM
How can I adjust that for each individual poll?
(Gerne auch auf deutsch) ;)

Xenon
01-01-2003, 10:35 PM
well, you have to use more if conditions then:
if(substr_count($insertsql,"(")>3 and $pollid==XX) {
eval("standarderror(\"You can just vote 3 options.\");");
} else if(substr_count($insertsql,"(")>5 and $pollid==yy) {
eval("standarderror(\"You can just vote 3 options.\");");
}

and so on

eL'Bandito
03-20-2005, 03:27 PM
anyone know how to do this for vb3 ???

the poll.php is not the same :(