vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Limit the poll selection. (https://vborg.vbsupport.ru/showthread.php?t=45639)

limgeorge 11-11-2002 09:35 PM

Limit the poll selection.
 
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:
PHP Code:

    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:
PHP Code:

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:
PHP Code:

if(substr_count($insertsql,"(")>and $pollid==XX) {
  eval(
"standarderror(\"You can just vote 3 options.\");");
} else if(
substr_count($insertsql,"(")>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 :(


All times are GMT. The time now is 12:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01156 seconds
  • Memory Usage 1,725KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete