======= Userpoll Plugin ====== ---- plugin ---- description: Lets you add polls to a wiki page author : Randolf Rotta email : randolf.rotta@gmail.com type : syntax lastupdate : 2013-05-09 compatible : 2012-01-25, angua depends : conflicts : similar : poll tags : poll downloadurl: https://trello.com/1/cards/5d5038cedecd2c3902cbab7b/attachments/5d50394c252f452b3cc90f00/download/userpoll.zip bugtracker : sourcerepo : donationurl: screenshot_img: ---- ===== Description ===== Use this plugin to add a poll to a wiki page. The syntax looks like this: [question] * [option] * [option] * ... That means, you can simply put ''%%%%'' tags around regular bulleted lists to get a radio button poll. ^ [id] | the ID of the poll; must be unique((If it is not, metadata of the polls with the same id gets mixed up, i.e. users who have voted for a previous poll with that id can't vote again.)); 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 [[plugin: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. ===== Download & Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. * [[https://trello.com/1/cards/5d5038cedecd2c3902cbab7b/attachments/5d50394c252f452b3cc90f00/download/userpoll.zip|userpoll.zip]] (8.2 KiB) ===== Languages ===== UPDATE: 2013-05-09 added German language support. Only English, French and Spanish supported so far. Russian is located below. ===== Revision History ===== * **2013-05-09**: * latest version, stable * **2007-02-09**: * first version, experimental ====== Discussion ====== 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: **We want this ?** ====== [yes] ====== [no] [Maybe] >Solved this idea with the following lines of code in lib/plugins/userpoll/syntax.php >If you use the syntax the ID of the current document is used as the userpoll ID or use e.g. 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 $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 $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 .= '' . '
' . '
' . '' . '' . '' . '
'; } */
---- == Possible Bug? == 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 [[http://studiy.tu-cottbus.de/projektwiki/_media/gruppen:ag_server:produkte:userpoll.tar.gz|here!]]