BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Poll

Solutions > Community > Poll

Summary: A simple script for creating member polls and displaying results.
Status: Experimental.
Maintainer: Caveman.
Downloads: poll.php, poll.backup. Requires Pagedata?.

This little script allows you to create polls and then display results. It requires some tinkering, but it has pretty wide open flexibility also. Extract the backup file and enable the php file using action.plugins. Then you are ready to create your first poll. Here's a sample:



For security settings, set read permissions of action.poll to @admin, or whoever you wish to be able to generate polls. This should only be trusted users. Your actual poll pages (poll*), need to have read authorization for the poll to be created. If you wish to hide the poll data from prying eyes, you might try putting a forwarder in the footer or header, to shift potential viewers to a different location.

As an admin, go to action.poll. Enter a pagename (recommended poll.#), a question, and then create a simple form according to the model below. Note the page name and save your results.

Sample Poll Form <code>
Excellent Good Poor [session pagedata "data={+p} page= value={=vote}"]
</code>

Now, go to a page (or sidebar, wherever) and enter the poll function. It can have the following parameters:

page: name of the poll page. required.
key: how each vote is logged, usually {id} or {ip} but must match the page= setting in the poll form.
round: how many digits to round results to. defaults to 0.

Options
All your normal options are available both in the poll form, and around the function that displays it. For example:

A conditional to tell if the individual has already voted could be as simple as [if set "{poll.name::{id}}"], as all votes are stored by pagedata as simple textvars.

The questions are stored as simple titles, so you could put together a page that generated a list of all existing polls, and perhaps using a get variable could display any poll desired.

Add a nextpage to the poll form to forward the voter to a different page to see the results.

If you would like more options for this form or have questions about how to customize it, please let me know.



Copyright © 2013, all rights reserved.