Use this plugin to add a poll to a wiki page. The syntax looks like this:
<userpoll [id]> [question] * [option] * [option] * ... </userpoll>
That means, you can simply put <userpoll>
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 main difference with Esther's plugin is that this plugin is user based. That is while Esther's poll allows one vote per client IP address. This one allows one vote per logged in user. It also remembers what every voter voted, to let them change their mind if they wish.
It is compatible with the poll plugin except that if there are one poll and one userpoll on a same page, voting for userpoll will make you vote for the poll one. The contrary is not true as userpoll checks for what you're voting for, which allows you do have several userpolls in a same page.
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
UPDATE: 2013-05-09 added German language support.
Only English, French and Spanish supported so far. Russian is located below.
<?php $lang['btn_vote'] = 'Голос'; $lang['btn_changemind'] = 'Поменять'; $lang['login_required'] = 'Нужно зарегистрироваться'; //Setup VIM: ex: et ts=4 enc=utf-8 :
Maybe you should have the title and the id different.
And maybe change the “*” that indicates a question to something else so you can do ordinary styles inside the poll.
Example:
<userpoll [ ID | Title ]> **We want this ?** <question> ====== [yes] ======</question> <question>[no]</question> <question>[Maybe]</question> </userpoll>
Solved this idea with the following lines of code in lib/plugins/userpoll/syntax.php
If you use the syntax <userpoll [PAGEID|Title]> the ID of the current document is used as the userpoll ID or use e.g. <userpoll [123|Title]>function render($mode, &$renderer, $data) { if ($mode == 'xhtml'){ global $ID; $options = $data[1]; $title = $renderer->_xmlEntities($data[0]); // prevent caching to ensure the poll results are fresh $renderer->info['cache'] = false; //starting modifications for syntax <userpoll [ID|Title]> $title=preg_replace( "/^\[/","",$title ); $title=preg_replace( "/\]$/","",$title ); if( preg_match( "/\|/", $title ) ) { $tmp_array = explode("|", $title); if( $tmp_array[0] == "PAGEID" ) { $pollid = $ID; } else { $pollid = $tmp_array[0]; } $title = $tmp_array[1]; if( strlen($title) > 0 ) { $title = '[' . $tmp_array[1] . ']'; } } else { $pollid = $title; } //$title = $title . "id=" . $pollid; //debug // get poll file contents //$pollid = md5('@userpoll@'.$title); $pollid = md5('@userpoll@'.$pollid); //end of modifications for syntax <userpoll [ID|Title]> $pfile = metaFN($pollid, '.userpoll'); $poll = unserialize(@file_get_contents($pfile));
Oli
I've excluded the chance for the users to modify their vote.. It's a very easy hack… You have simply to edit syntax.php and comment the code from line 174 to line 183.
/*if ($pollid) { // user had already voted, allow him/her to changer his/her mind $ret .= '<tr><td colspan="4">' . '<form id="userpoll__form" method="post" action="'.script().'" accept-charset="'.$lang['encoding'].'">' . '<div class="no"><input type="hidden" name="do" value="show" />' . '<input type="hidden" name="pollid" value="' . $pollid . '" />' . '<input type="hidden" name="id" value="'.$ID.'" />' . '<input type="hidden" name="vote" value="@FORGET@">' . '<input class="button" type="submit" value="' . $this->getLang('btn_changemind') . '"></form></div></td></tr>'; } */
Not sure where to report bugs in this plugin. We just downloaded it and tried it in our installation (on 1/24/08). Some people were able to vote, while others were not. That is, they cast their vote, but in the results screen, they didn't see their vote reflected. I can obtain more information on this end if there's someone on that end who's interested. Thanks!
Quick update on this: I figured out what the problem was. One of the choices in the poll did not work, either because of an ampersand (&) or an apostrophe ('). I created a new poll and took those symbols out, and everything worked. Just FYI for anyone who uses this plugin.
— 04/01/2012 An error message,
Security Token did not match. Possible CSRF attack.
Something like this don't know why???
— 09/05/2013
Problem solved due to changes in the newest version. Redownload the plugin here!