Firefox PHP

Poll Module

Posted by arlo 
All files from this thread

File Name File Size   Posted by Date  
poll.zip 5.5 KB open | download arlo 08/21/2004 Read message
poll.zip 6.8 KB open | download pat 10/03/2004 Read message
poll.gif 197 bytes open | download Ryan 10/15/2004 Read message
poll_icon.gif 154 bytes open | download Ryan 10/19/2004 Read message
screenshot1.gif 3.5 KB open | download Ryan 11/29/2004 Read message
screenshot2.gif 5.2 KB open | download Ryan 11/29/2004 Read message
poll.php 11.8 KB open | download Ryan 11/29/2004 Read message
poll_n_icons.gif 19 KB open | download Ryan 02/28/2005 Read message
icons.zip 2.5 KB open | download Ryan 02/28/2005 Read message
poll.ZIP 7.1 KB open | download amilcarpt 03/04/2006 Read message
Poll Module
July 27, 2004 02:06AM
Hi,

I've written a module that lets you create simple polls within messages. You can give either moderators or registered users permission to create polls via the module settings. Unregistered users can't start polls or vote. This is my first nontrivial mod, so I'd appreciate any tips on my coding style or suggestions for improvement. And of course, you're welcome to fiddle with it and make it better.

---

From the readme.txt file:

In addition to placing the poll directory inside mods and turning the
poll module on, you need to do the following:


1. Phorum Admin -> Custom Profiles -> add a profile field called mod_poll


2. Add {POLLFORM} to the post_form.tpl template

Within the post form (on top of the message body is best), add the line:

{IF POLLFORM}{POLLFORM}{/IF}


3. Add a New Poll link to your templates.

For example, you could add the following line to list.tpl, read.tpl,
and others:

{IF NEWPOLLURL}<a class="PhorumNavLink" href="{NEWPOLLURL}">New Poll</a>{/IF}


******
EDIT: see below for a newer version of the module
******



Edited 2 time(s). Last edit at 08/21/2004 05:27AM by arlo.
Re: Poll Module
July 27, 2004 02:11AM
Here are some ideas for improvement in case anyone wants to try...

allow people to edit their polls
allow users to add write-in votes
don't require a message body
allow users to change their votes
add restrictions on which forums can have polls
allow unregistered users to vote

EDIT:
localize the strings



Edited 1 time(s). Last edit at 07/29/2004 04:57AM by arlo.
Re: Poll Module
July 27, 2004 02:20AM
******
EDIT: see below for a newer version of the module
******



Edited 1 time(s). Last edit at 08/21/2004 05:27AM by arlo.
Re: Poll Module
July 27, 2004 04:45AM
Sounds interesting. Do you have an example forum where one could see it in action?

registered users can only vote once in a poll? (like it should be :))


Thomas Seifert
Re: Poll Module
July 27, 2004 05:07AM
ts77 Wrote:
-------------------------------------------------------
> Sounds interesting. Do you have an example forum
> where one could see it in action?

Sure...

[www.alouie.com]

> registered users can only vote once in a poll?
> (like it should be :))

Yup!
Re: Poll Module
July 27, 2004 09:32AM
Ok arlo, you are starting to rock.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
pat
Re: Poll Module
July 27, 2004 01:53PM
Very nice !

pat
Re: Poll Module
July 28, 2004 05:22PM
Impressive, well done. A couple of suggestions for a future version:

- Since you know what option a user voted for, can you let them change their vote? (maybe by letting them revoke their original vote, so it'll think they haven't voted)

- If a poll creator makes a typo or something, a way to edit the poll to correct that.
Re: Poll Module
July 29, 2004 05:01AM
Tridus Wrote:
-------------------------------------------------------
> Impressive, well done. A couple of suggestions for
> a future version:
>
> - Since you know what option a user voted for, can
> you let them change their vote? (maybe by letting
> them revoke their original vote, so it'll think
> they haven't voted)

That's a good, easy solution -- I'll put that into the next version.

> - If a poll creator makes a typo or something, a
> way to edit the poll to correct that.

Hmm... that's a little tougher. :)

Thanks to everyone for all the feedback.
Re: Poll Module
July 29, 2004 08:02AM
arlo Wrote:
-------------------------------------------------------

>
> Hmm... that's a little tougher. :)

Yeah, I ran into a similar problem in the avatar module. What I ended up doing is checking what page is being looked at, and if its edit.php/moderation.php, setting up the avatar list based on which one is presently selected in whatever post is being looked at rather then the users defaults.

You could do something similar here. Add a link to the poll when the poll creator is looking at it that goes to edit.php with a poll flag on it like how the newpoll link works. When on the edit page, if you see that flag display the existing poll information in an editable way.

Then use the pre_edit hook to process the changes. Shouldn't be too bad. :)

Sorry, only registered users may post in this forum.

Click here to login