Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Poll Extension for Vanilla 0.9.3

edited September 2006 in Vanilla 1.0 Help
Latest Version
Poll Extension 0.1
Requires Vanilla 0.9.3 beta snapshot from Dec 28 or later.

To use, you need to install two tables:
CREATE TABLE `LUM_Poll` ( `PollID` int(8) NOT NULL auto_increment, `DiscussionID` int(8) NOT NULL default '0', `Title` varchar(255) NOT NULL default '', `Options` text, PRIMARY KEY (`PollID`) ) ENGINE=MyISAM; CREATE TABLE `LUM_PollVote` ( `PollID` int(8) default NULL, `UserID` int(10) default NULL, `Vote` int(3) NOT NULL ) ENGINE=MyISAM;

You can go to to see what it's like.
You can log in with username "User1" through "User7", and password "vanilla".

Original post
I'm working on a Poll extension to Vanilla. I haven't gotten to the PHP part yet, but I'd like some feedback on the default style and javascript mechanism.

I'm not sure how to place it in the discussion though. Suggestions?

I'm new to Vanilla development though, so I'd like to know.. would this be possible with an extension alone? What should I do to make it easy for the user to set up the tables required (an install script?)

I'd like to get some tips on where to start. I'm experienced with PHP, and I've already written two patches (for the Opera and Safari bug), so I could figure it out myself, but it would be nice to get some tips from those with more experience writing extensions to vanilla.


  • Awesome.
  • Seems awesome, we are gradually getting to the point where we have the unnecessary gadgets that some forum users demand even tho they have no actual use and they are used once or twice a year, and even then it is a novelty. I hate it when I suggest people to migrate to Vanilla and they are like "but it doesn't have polls, or this and that unnecessary feature that you could as well put in to your site by some cleverly hacked poll script that is as good or even better than the one integrated to your forum engine" Now if the Vanilla 1 will introduce quotation nobody should have anything to say.
  • and bbcode buttons on the form.
  • edited December 2005
    I think it'd be nice built into the control panel. If it was forum wide it could stay there all the time, or if it was for a particular discussion it could just appear on that discussion (and add [poll] or whatever like [sticky] etc.) While it might be a handy feature, what we do have to remember is that technically the discussion is the most important part of the forum (surprise!) so i think it's important to avoid disrupting the flow of the text. The most that should be put into the body of the forum (imo) is perhaps a 'polled' like the 'edited' next to someones name if it isnt an anonymous vote.
  • i'd definitely use a poll function and that looks well underway. as for feedback on the default style. are you looking to make it fit with mark's default vanilla style?

    If so then you need to change the font to font-family: Trebuchet MS, Verdana, Tahoma, Arial; and i'd swap the green for yellow #FEF9E9 with a border of #FFEDAE.
  • The parentheses are funky on Opera. Other than that, pretty sweet.
  • I actually thought polls wouldn't be a problem when I created my community. But even though it was very small, the need immediately came up. So that's why I decided to go for it myself. timberford: I dunno.. I think it might be good to distinguish it, but I'll tweak the style more after I have it integrated with the forum to see what works out. I'll make sure to fix the font. I can imagine it doesn't look too great for you Windows users who don't have Lucida Grande, I didn't think about that before publishing it. I haven't made much progress.. Just been looking through existing code to see how the extensions system is built. It looks like it might be pretty straightforward.
  • I'm looking forward to see a poll extension for Vanilla. It's looking really promising, skyfex - keep up the good work!
  • yeah once it's integrated it will be a lot easier to tweak visually. will be good though
  • JanJan
    edited December 2005
    Apples to Oranges has some really cool CSS styling techniques for bar graphs. This might be of interest.
  • I think I'm going to develop this extension for 0.9.3 instead. Is everyone okey with that? (=P) It just seems to be too much work with
  • fine with me :D
  • Yeay.. It was much easier to get started with 0.9.3. Thanks to jazzman for the Attachment extension. It helps a lot. So I've managed to add the test-poll to discussions. It shouldn't be too hard from here on out. Just a lot of coding. It's the only place I could put it with just delegates. But I think it looks fine. CSS can still change, so I will still take suggestions for the default style. Perhaps I'll match the Attachment extension and make it a blue shade. It would match the default vanilla style more too. But I like the green. It kind of screams "Look at me! I'm a poll!" =P I'll see what it looks like in blue.
  • This is what I came up with: I still like the green better. I couldn't get orange (like the comment form) to work out.
  • edited December 2005
    Is there anyway to tell from the "PreCommentOptionsRender" delegate's parameters whether a comment is the first one in the thread?
  • Yeah.. There is, I think, but it doesn't seem to be completely straightforward. I could place it inside the body of the text (at the beginning would probably be best). Perhaps that would be better. What do you guys think?
  • edited December 2005
    Small update:
    I've managed to load the data from the database, instead of being just hardcoded. The extension needs two new tables:

    `PollID` int(8) NOT NULL auto_increment, `DiscussionID` int(8) NOT NULL default '0', `Title` varchar(255) NOT NULL default '', `Options` text
    `PollID` int(8) default NULL, `UserID` int(10) default NULL, `Vote` int(3) NOT NULL

    Where "Options" is a serialized array, with the title of the options (for example serialize(array("The Simpsons", "South Park")); ).

    Major tasks left is:
    - Voting through AJAX
    - Creating a poll in the Discussion form
  • edited December 2005
    What is the standard method for extensions to use AJAX? Edit: Nevermind. I found an example.
  • The AJAX voting is complete! There are probably security holes though. I have to go through the code eventually to check that users can't vote in discussions they're not allowed to access etc.. Should users be allowed to vote in a closed discussion?
  • lechlech Chicagoland
    I'd recommend that if the discussion is closed, then voting should also be closed for that discussion.
This discussion has been closed.