Back to vBulletin 3.6 Add-ons

Poll Write-In & Change Vote Hack
Mod Version: 1.5, by TomasDR

This modification is in the archives.
vB Version: 3.6.8 Rating: (13 votes - 4.69 average) Installs: 96
Released: 24 Mar 2007 Last Update: 15 Dec 2007 Downloads: 335
Not Supported DB Changes Uses Plugins Template Edits  

Poll Write-In Vote Hack

This is only for 3.6.x, you can find my 3.7.x version here.

About this hack:
I developed this hack for my board after several polls were made by members that were short on options, especially since the poll creators are sometimes biased with the poll options. I am sure you have seen the same on your boards.

This hack allows the poll creator to allow "Write-In Votes" to a poll (single or multiple). I also added the feature to change your vote if the poll is a "write-in vote" poll, you can also allow vote changes on all polls through an admin option (ver 1.2+). This will allow a user to change their vote if they discover a better poll option written in by another user, or if they want to add one or more write-in votes to a multiple choice poll.

An admin/moderator/etc. who has permission to edit a poll can change a poll to make it a write-in poll or not. (ver 1.3+)

The cancel/change vote feature works with single and multiple choice polls.

This is my first hack but please don't let that scare you away, this is a very basic hack.

Permission Overview:

There are very few permission checks with my hack;
  • If you can create a poll, you can make it a write-in vote poll.
  • If you can vote on the poll, you can add a write-in vote to a write-in poll.
  • If the poll is closed you cannot change your vote or add a write-in vote of course.
  • You cannot add a write-in vote to a non write-in vote poll.
Permission Settings:

Located in vBulletin Options "Poll and Thread Rating Options" section.
  • Allow users to change their votes in ANY poll. (Default NO)
  • Show the username after a write-in vote. (Default Yes)
    * If NO a log entry is written to the moderator log as per a request, see pic below
Install Info:
  • Files edited: 0
  • Templates edited: 3
  • Files to install: 1
  • Time to install: 5 minutes max
Install Procedure:
1. Install the Product (Download the XML file)
2. Edit Template polloptions_table
FIND
Code:
<input type="submit" class="button" value="$vbphrase[vote_now]" />
ADD ABOVE
Code:
<if condition="$pollinfo[writein]"><span style="float:$stylevar[right]"><a href="poll.php?$session[sessionurl]do=addwritein&amp;pollid=$pollinfo[pollid]">$vbphrase[add_writein_vote]</a>&nbsp;&nbsp;</span></if>
3. Edit Template pollresults_table
FIND
Code:
<td class="tfoot" colspan="4" align="center"><span class="smallfont"><if condition="$show['multiple']">$vbphrase[multiple_choice_poll] </if>$vbphrase[voters]: <strong>$pollinfo[numbervotes]</strong>. $pollstatus</span></td>
REPLACE WITH
Code:
<td class="tfoot" colspan="4" align="center"><span class="smallfont"><if condition="$show['multiple']">$vbphrase[multiple_choice_poll] </if>$vbphrase[voters]: <strong>$pollinfo[numbervotes]</strong>. $pollstatus<if condition="$vbulletin->options['allchangevote'] OR $pollinfo[writein]"><if condition="$uservoted AND $pollinfo[active]">&nbsp;&nbsp;<a href="poll.php?$session[sessionurl]do=changevote&amp;pollid=$pollinfo[pollid]">$vbphrase[change_vote]</a></if></if></span></td>
4. Edit Template editpoll
FIND
Code:
<if condition="$show['makeprivate']"> <fieldset class="fieldset"> <legend>$vbphrase[poll_options]</legend> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"> <tr> <td><label for="cb_public"><input type="checkbox" name="public" value="1" id="cb_public" tabindex="1" $pollinfo[public] />$vbphrase[make_votes_public]</label></td> </tr> </table> </fieldset> </if>
REPLACE WITH
Code:
<fieldset class="fieldset"><legend>$vbphrase[poll_options]</legend><table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">$addwritein<if condition="$show['makeprivate']"><tr> <td><label for="cb_public"><input type="checkbox" name="public" value="1" id="cb_public" tabindex="1" $pollinfo[public] />$vbphrase[make_votes_public]</label></td></tr></if></table></fieldset>
5. Enjoy!
Version Info:


Version 1.0:
  • Initial release of the hack
Version 1.1:
  • Added a requested feature (please see screenshot) so now the username is recorded after a write-in vote.
  • Added an error/permission check for max poll options that is set in vBulletin options by the admin so a write-in poll cannot exceed that number.
  • Added two new error messages reflecting the max poll option error & a specialized error message for entering a blank write-in vote.
Version 1.2:
  • Added the feature (suggested by bchertov) to be able to allow your users to change their vote in all polls. This is now a vBulletin Option located in the Setting Group Poll and Thread Rating Options the option is Allow Users to Change Their Votes in ALL Polls as a Yes/No, if set for 'No' they will still be able to change their vote in Write-in polls as before. NOTE: The template edit has changed for the template pollresults_table with this version!
  • Fixed the bug reported by A_V concerning poll max options being set for zero/unlimited.
  • Added the Write-in permission check along with the vB option for allowing users to change votes in the plugin http://news.insearchofchicas.org/forum/admincp/plugin.php?do=edit&pluginid=1082.
Version 1.3:
  • Added the requested feature to allow changing the Write-In option when Editing Polls. Note: There is an additional template (editpoll) to edit with this new version.
Version 1.4:
  • Added the ability to turn off the username added after a write-in vote.
  • Added logging to the moderator log if the username addition is turned off per a request.
Version 1.5:
  • Found a bug if you allow the "Unregistered / Not Logged In" group to vote in polls. If they change their vote they will change all guest's votes. You only need to upgrade if you allow Unregistered users the ability to vote in polls.
Version 3.6.8:
vBulletin 3.6.8 has the ability to filter by product in the moderator log. This is the only difference between the xml files.

Please post your comments or suggestions for this hack. I will read ALL posts.

PLEASE CLICK !
(You will get an email when a new version is released.)


Pictures:
  1. Showing the "Write-In" checkbox under Miscellaneous Options when creating a poll.
  2. Showing the poll with the link to add a write-in vote.
  3. Showing the screen to add a write-in vote.
  4. Showing the new poll with the new write-in vote and the link to Change your vote.
  5. Showing the new feature (ver 1.1) where the username is placed after the write-in vote.
  6. Showing the moderator log entry.

Download

This modification is archived, downloads are still allowed.

File Type: %1$s product-poll_write_in_vote.xml (14.3 KB, 79 downloads)
File Type: %1$s product-poll_write_in_vote_3.6.8.xml (14.5 KB, 135 downloads)

Screenshots

Click image for larger version
Name:	chkbox.jpg
Views:	927
Size:	13.5 KB
ID:	62232   Click image for larger version
Name:	poll.jpg
Views:	877
Size:	16.3 KB
ID:	62233   Click image for larger version
Name:	addwritein.jpg
Views:	814
Size:	17.7 KB
ID:	62234   Click image for larger version
Name:	change.jpg
Views:	900
Size:	15.5 KB
ID:	62235  

Click image for larger version
Name:	uname.jpg
Views:	771
Size:	21.1 KB
ID:	62274   Click image for larger version
Name:	modlog.jpg
Views:	290
Size:	19.1 KB
ID:	72655  


vblts.ru supports vBulletin®, 2022-2024