vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   New poll feature: Multiple choice poll! (https://vborg.vbsupport.ru/showthread.php?t=30921)

Admin 10-20-2001 10:00 PM

I know a lot people wanted and asked for this, so here it is, just for you! (and me :))

Pretty simple actually.
This adds an option to the new poll screen (screenshot 1), that lets you choose between a regular poll (like it is now), or a multiple choice poll.
If the latter is selected, instead of radio buttons there will be check boxes (screenshot 2).

I also must say that installation is rather simple.
All you need to do is edit 2 files, and 1 template.
The rest is done automatically.
This is the place to thank Bane that generously let me use his great installer!

Without further ado, here's the installer:
Installer - just upload to your admin folder and run in your browser.
(note: all installation is reversable. uninstallation can be done from the installer)
For a small add-on (not included in the installer), please see this page.

Admin 10-21-2001 03:24 PM

First screenshot - new poll screen.

Admin 10-21-2001 03:24 PM

Second screen shot - show thread screen.

Bane 10-21-2001 03:28 PM

Installed and working great on talkloud :) Great hack sir!

I may have mentioned this

Bane 10-21-2001 03:39 PM

Screen Shot on Talkloud!

Bane 10-21-2001 03:51 PM

After Vote :D

floleb7 10-21-2001 03:56 PM

but i see 2 votes but really it's one vote and 2 choices :D

Silviu 10-21-2001 04:26 PM

Hmm, i've downloaded the hack but there seems to be a small error. The field "multiple" from table "poll" is installed incorectly: actually is inserted as "mulitple" by your installer. So, when voting MySQL will generate an error: "multiple not in field list". :)
I've fixed it by setting the correct field name in MySQL administration panel.

BTW, great hack :D

drumsy 10-21-2001 04:43 PM

I'm confused, does the installer do EVERYTHING for us, or is there something we're supposed to do manually. I installed it, but I get no choice to create the other poll.

Admin 10-21-2001 05:26 PM

New installer (can't update first post).
Thanks. :)

drumsy, everything is on screen. What I can automatically is already done by the installer. You will need to do other changes to two files and another template.

cyrus 10-22-2001 08:30 AM

beautiful hack BUT, when I use it with vbportal, it doesnt allow multiple selections on the portal :(

can anyone help ?

cyrus 10-22-2001 08:36 AM

also, gives an error that I have not selected an option even when I know I have , so I cant vote full stop ! :(

Bane 10-22-2001 09:45 AM

Cyrus, you'll likely have to do some additional hacking if you want this to appear in the front page poll.

BluSmurf 10-22-2001 10:17 AM

great hack, installed with ease!

c0bra 10-22-2001 12:56 PM

Another great hack FireFly! Installation was a breeze, thanks very much... :D

GenSec 10-22-2001 01:45 PM

Quote:

Originally posted by Cyrus
beautiful hack BUT, when I use it with vbportal, it doesnt allow multiple selections on the portal :(

can anyone help ?

  • Add temlate P_polloption_mult
    Code:

    <tr>
      <td bgcolor="#DFDFDF" width="5%"><input type="checkbox" name="allvotes[$P_option[number]]" value="yes"></td>
      <td bgcolor="#DFDFDF" colspan="3"><smallfont>$P_option[question]</smallfont></td>
    </tr>

  • Find in vbpstuff.php
    Code:

    eval("\$P_pollbits .= \"".gettemplate("P_polloption")."\";");
    Replace with
    Code:

    // Multi-Choice Hack
          if ($P_pollinfo[multiple]!=0) {
            eval("\$P_pollbits .= \"".gettemplate("P_polloption_mult")."\";");
          } else {
            eval("\$P_pollbits .= \"".gettemplate("P_polloption")."\";");
          }
    // Multi-Choice Hack

That's all.

P.S. Bravo FireFly!

cyrus 10-22-2001 04:37 PM

there is no file called vbpstuff.php in version 2.0.3 if vbportal !!!

:(

Admin 10-22-2001 05:05 PM

Small addon re floleb7's first post.
This will display the number of voters with multi choice polls, instead of number of votes.

In showthread.php, find this:
Code:

  $counter=0;
  while ($counter++<$pollinfo[numberoptions]) {
    $pollinfo[numbervotes]+=$splitvotes[$counter-1];
  }

and add this right below it:
Code:

  if ($pollinfo[multiple]!=0) {
    $getvoters=$DB_site->query_first("SELECT COUNT(DISTINCT(userid)) AS voters FROM pollvote WHERE pollid='$pollid'");
    $pollinfo[voters]=$getvoters[voters];
  } else {
    $pollinfo[voters]=$pollinfo[numbervotes];
  }

Now in showthread_pollresults template, replace $pollinfo[numbervotes] votes with $pollinfo[voters] voters.

Easy wasn't it? :)

cyrus 10-22-2001 05:09 PM

what about me FF ?? :( :(

RobAC 10-22-2001 05:15 PM

I get all kinds of undefined function errors such as cpheader and makelinkcode. :(

Admin 10-22-2001 05:16 PM

Cyrus, I don't use vbPortal.

RobAC, I suspect you didn't upload the installer to the admin folder. Is that correct?

RobAC 10-22-2001 05:21 PM

argh.....ok.....just slap me now! :mad: ;)

Admin 10-22-2001 05:34 PM

*looks around - BAM!*

RobAC 10-22-2001 05:36 PM

Works perfectly! Thanks Chen! :D

MarkG 10-23-2001 07:11 AM

it's wonderfull firefly!

thanks!!

http://apolyton.net/forums/showthrea...threadid=30204

GenSec 10-23-2001 07:39 AM

Quote:

Originally posted by Cyrus
there is no file called vbpstuff.php in version 2.0.3 if vbportal !!!

:(

In your vbportal version should be something analogical. Look in your "phpinclude" template.

cyrus 10-23-2001 07:54 AM

Ive searched high and low, cant seem to find it anywhere myself :(

what should I Do ???

GenSec 10-23-2001 08:09 AM

Quote:

Originally posted by Cyrus
Ive searched high and low, cant seem to find it anywhere myself :(

what should I Do ???

[list=1][*]To find temlate which produce poll table on your portal page. (Use admin CP -->options-->templates-->yes. Then view source of your page)[*]Find php file, which uses this template[/list=1]

cyrus 10-23-2001 08:25 AM

i did that,

I then went and daw the source for the vbportal homepage, and it says p_home is the template.
so i searched for p_home in the vbp files and mailfile.php and header.php seem to mention it

what now ?

GenSec 10-23-2001 09:31 AM

It can't be p_home. The temlate name should be like polloption... and looks like
Code:

<tr>
  <td bgcolor="#DFDFDF" width="5%"><input type="checkbox" name="allvotes[$P_option[number]]" value="yes"></td>
  <td bgcolor="#DFDFDF" colspan="3"><smallfont>$P_option[question]</smallfont></td>
</tr>


cyrus 10-23-2001 09:36 AM

that was what you told me to add in a new template as on the first post on page 2 of this thread!!!

:confused:

GenSec 10-23-2001 10:02 AM

O, sorry. The original looks practically the same
Code:

<tr>
  <td bgcolor="{secondaltcolor}" width="5%"><input type="radio" name="optionnumber" value="$P_option[number]"></td>
  <td bgcolor="{secondaltcolor}" colspan="3"><smallfont>$P_option[question]</smallfont></td>
</tr>


cyrus 10-23-2001 11:13 AM

right

so what do I do ???

what template do I edit and/or what php file do i edit ??

:confused:

Bane 10-23-2001 11:17 AM

P_polloptions or something to that effect

cyrus 10-23-2001 11:22 AM

this is what I got in p_polloptions template :-

[QUOTE]<form action="$bburl/poll.php" method="get">
<input type="hidden" name="s" value="$session[dbsessionhash]">
<input type="hidden" name="action" value="pollvote">
<input type="hidden" name="pollid" value="$P_pollinfo[pollid]">
<table cellpadding="{tableouterborderwidth}" cellspacing="0" border="0" bgcolor="{tablebordercolor}" {tableouterextra} width="{contenttablewidth}" align="center"><tr><td>
<table cellpadding="4" cellspacing="{tableinnerborderwidth}" border="0" {tableinnerextra} width="100%">
<tr>
<td bgcolor="{tableheadbgcolor}" align="center" colspan="4"><smallfont color="{tableheadtextcolor}"><b>$P_pollinfo[question]</b></smallfont></td>
</tr>
$P_pollbits
</table>
</td></tr></table>
<table cellpadding="2" cellspacing="0" border="0" width="100%" {tableinvisibleextra} align="center">
<tr>
<td style="font-size: 8pt"><smallfont><input type="submit" class="bginput" value="Vote!" style="font-size: 8pt">
<a href="$bburl/poll.php?s=$session[sessionhash]&action=showresults&pollid=$P_pollinfo[pollid]">View Results</a>
</smallfont></td></tr>
</table>
</form>

GenSec 10-23-2001 11:23 AM

You need create new template as shown above
and modify php file which use this template simular as made by FireFly for vB or in my first post.

GenSec 10-23-2001 11:25 AM

You need P_pollbits temlate if you have.
In my case $P_pollbits based on P_polloption temlate. I guess you have P_polloption also.

cyrus 10-23-2001 11:30 AM

i cant see any P_pollbits template listed here
BUT, I do have P_polltions as stated above

wht should I do ?

GenSec 10-23-2001 11:34 AM

Look for P_polloption

GenSec 10-23-2001 11:36 AM

Quote:

Originally posted by Cyrus
i cant see any P_pollbits template listed here
BUT, I do have P_polltions as stated above

wht should I do ?

Just what I say in first post.
Create new template and look for php file which create P_pollbits from P_polltions


All times are GMT. The time now is 09:33 PM.

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.01393 seconds
  • Memory Usage 1,816KB
  • 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
  • (7)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete