# Polls Plugin

Polls used to be an integral part of the Geeklog core code, but have been moved to a plugin as of Geeklog 1.4.0.

## Configuration

The Polls plugin's configuration can be changed from the Configuration admin panel:

### General Polls Settings

Variable | Default Value | Description
--- | --- | ---
pollsloginrequired | 0 | When set to 1, only registered users can access the list of recent polls. Please note that `$_CONF['loginrequired']` in Geeklog's main configuration takes precedence over this setting. So when `'loginrequired'` is set to 1, anonymous users can not access the recent polls even when `'pollsloginrequired'` is set to 0.
hidepollsmenu | 0 | Whether to hide the "Polls" entry from Geeklog's menu bar (when set to 1) or to show it (when set to 0).
maxquestions | 10 | Maximum number of questions in a poll.
maxanswers | 10 | Maximum number of options per question.
answerorder | submitorder | Sort answers by the number of results ('voteorder') or keep the order in which they were entered ('submitorder').
pollcookietime | 86400 | Number of seconds to set a poll answer cookie to time out on.
polladdresstime | 604800 | Number of seconds to set a poll answer IP address to time out on.
delete_polls | 0 | Defines what to do when a user is deleted that is the owner of a poll. When set to 0, all polls owned by the deleted user will be assigned to a user of the "Root" group (e.g. the site admin). When set to 1, the polls are deleted, including all the comments posted on that poll.
aftersave | 'list' | Which page to go to after a poll has been saved: 'item': display the poll 'list': show admin's list of polls (default) 'plugin': display the public list of polls 'home': display the site's homepage 'admin': go to the "Admin Home" page, i.e. Command & Control
meta_tags | false | Whether to include the meta tags of the poll when it is displayed.

## How do the polls work?

(Taken from the Geeklog FAQ)

In order to prevent manipulation of polls (or at least make it harder), Geeklog does two things when you vote:

1. It stores a cookie
2. It stores your IP address

Both the cookie and the IP are valid for a certain amount of time (see below) and during that time, you can't vote again on the same poll.

The amount of time your cookie and IP are stored can be changed in the polls plugin's configuration (see above):

    $_PO_CONF['pollcookietime']    = 86400;
    $_PO_CONF['polladdresstime']   = 604800;

Both times are in seconds, i.e. the cookie is valid for 24 hours and the IP is stored for a week.

In setups where more than one person uses the same computer or the same IP address, you can set one (or both) of them to 1.

Please keep in mind that any poll can be manipulated, so you shouldn't take the results too seriously.

## Autotags

The Polls Plugin provides 3 autotags, `[poll:]`, `[poll_result:]`, and `[poll_vote:]`.

- The `[poll:]` autotag will provide a link to a poll. Simply add the poll's ID after the colon. By default, the poll's title will be used as the link text. You can provide your own link text after the poll ID (but before the closing bracket).
- The `[poll_result:]` autotag lets you embed the results from a poll in a story (or anywhere else where autotags are allowed).
- The `[poll_vote:]` autotag can be used to embed a poll into an article (or anywhere else where autotags are allowed) so that users don't need to go to the polls block to vote.