DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:poll

Poll Plugin

Compatible with DokuWiki

>=2006-11-06

plugin Lets you add polls to a wiki page

Last updated on
2016-04-25
Provides
Syntax
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to multipoll, quiz, userpoll, vote

Tagged with !experimental, poll

Syntax

Use this plugin to add a poll to a wiki page. The syntax looks like this:

<poll [id]>
  [question]

  * [option]
  * [option]
  * ...
</poll>

That means, you can simply put <poll> tags around regular bulleted lists to get a radio button poll.

[id] the ID of the poll; must be unique1); appears as title required
[question] the question you'd like to ask optional
[option] a possible answer to the above question required

The poll title is converted to a md5sum. This is used as the filename in data/meta: md5sum.poll - so all polls in the whole wiki must be unique. As a result you can move your poll around and the poll data is accessible. If you remove the poll you must remove the poll data with “rm”.

Demo

You can see the demo here: http://www.ichiayi.com/wiki/tech/dokuwiki_plugin/poll

tryweb 2019-10-15 05:41

Installation Notes

When the blog plugin is also installed, you need to turn $conf['plugin']['blog']['useifmodifiedsince'] off. I will try to eliminate this incompatibility.

Bugs / Feature Requests

Please report bugs or feature requests at the Bug tracker.

Changes

Discussion


How to allow multiple polls in one page

In the file … /lib/plugins/pool/synthax.php
Add the parameter $title to the function _pollForm

<    function _pollForm($options, &$renderer) {
>    function _pollForm($options, &$renderer, $title) {  

Add it in it's call too:

<                $renderer->doc .= $this->_pollForm($options, $renderer);
>                $renderer->doc .= $this->_pollForm($options, $renderer, $title);

add md5($title) to group radio name in the form

<                '<input type="radio" name="vote" id="poll__option'.$i.'" '.
>                '<input type="radio" name="vote'.md5($title).'" id="poll__option'.$i.'" '.

and finally add md5($title) to the radio button filter

<            } elseif ($vote = $_REQUEST['vote']) {
>            } elseif ($vote = $_REQUEST['vote'.md5($title)]) {

Note that the votes should be submitted one by one

Have a nice day,


I am running DokuWiki 3.09. I am getting the following error

 Warning: Missing argument 2 for metaFN(), called in /blah/dokuwiki/lib/plugins/poll/syntax.php on line 79 and defined in /blah/dokuwiki/inc/pageutils.php on line 160 

The 2 MetaFN args are id and extension and your code reads $pfile = metaFN(md5($title).'.poll'); I changed it to read $pfile = metaFN(md5($title),'.poll'); to make it work i.e. changed period to comma


What do you think about adding multiple choices per vote? (with checkboxes instead of radio buttons)


If I have multiple polls on one side and i vote in the first poll, the answer is taken also in the second poll (which has the same answer as choice). Is it not possible to have more than one poll in one side?

I have the same bug. Submit a vote submit the same values for all <poll> </poll>.


Would be better, if the plugin looks for the username instead of the ip-address, if authentication is enabled. We have the problem that some people aren't able to vote, because they are sitting inside a campus, and connect all with the same IP to the internet (NAT).

Your code reads:

$ip = clientIP(true);

I changed it to:

global $USERINFO; 
$ip = $USERINFO['name'];

$ip is now the logged-in User, no longer the IP-address. Works well for us. Maybe you add a condition for non-authentication.


I have the same problem (Warning: Missing argument 2 for metaFN(), called in lib/plugins/poll/syntax.php on line 79 and defined in wiki/inc/pageutils.php on line 160). I change changed period to comma but the massage stay here… Any solution? Thanks very much. Thomas Baldi


All options in the poll appear on the same line. Can the options be made to appear on different lines like the default unordered lists of DokuWiki? Using latest version of DokuWiki. Thanks. Shiva


I just used and got a few problems but fixed with couple minor tweaks. First, the table just simply looked wrong, because it had a fixed table width, so I edited the style.css and removed the width entry. Next, in IE, the poll bar was somehow aligned to mid and it looked just wrong, though Firefox and Opera looked ok, I added 'text-align: left' to 'div.dokuwiki div.poll_bar' entry in style.css and it got fixed. Hope these are incorporated in official tree. Tx. Btw 'vote' in Japanese is called '投票', so, if u can copy and paste this without problem, u can make ja version too.:-)


How can I see the results of a poll without voting? Thanks!


Is there a way to comment out or change code to allow a user to vote, come back later vote again, and vote again?

Reason I ask is I want to use something like this actually as an issue tracker. The “answers” to the poll are actually tech support issues. I want users to “vote” on an issue any time it comes up on a tech support call.

This way we can trace how many times the issue has come up.

Or is there any other plugin similar to what I am trying to do?

Thanks, Tony


Hi,

I find this plugin really handy. Same question as the previous one ⇒ is there a way to change a vote ?

Another one : Is there a way to have several question in the same vote and only one vote button ?

thank, JL


I'd appreciate using one pass of the submit button for two questions per poll. In other words, my favorite fruit is apples, my favorite color is blue, press SUBMIT. Even better would be if I could (even if it is just manually) look in the database to see how many people like blue and apples (together). — AndrewZ, 16 March 2008


Hi, I suggest to save the username of people that have poll instead of the his/her IP address !


Hi, who can tell me where is the results of the polls. Thanks

Um, can you add more than three choices? Because I can't….

You can see the demo on the URL : http://www.ichiayi.com/wiki/tech/dokuwiki_plugin/poll

Jonathan Tsai 2008/08/29 21:01

Doodle Poll Plugin V2.0

I merged the doodle, vote and userpoll plugins into one with all their features. Have a look at doodle2. I already asked the author of this plugin. We see the doodle2 as the new version. — Doogie - September 2010

1)
If it is not, metadata of the polls with the same id gets mixed up, i.e. users with IPs who have voted for a previous poll with that id can't vote again.
plugin/poll.txt · Last modified: 2019-10-15 05:41 by tryweb

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki