vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   Miscellaneous Hacks - Poll Write-In & Change Vote Hack (https://vborg.vbsupport.ru/showthread.php?t=198535)

TomasDR 12-09-2008 10:00 PM

Poll Write-In & Change Vote Hack
 
Poll Write-In Vote Hack

This is only for 3.7.x, you can find my 3.6.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.
  • If you can Edit a Poll you can remove a write-in choice.
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
  • Since version 3.6.8 vBulletin has had the ability to filter by product in the moderator log so you can filter the write-in votes if you chose not to have the username displayed.
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.6:
  • Updated for vBulletin 3.7.x
Version 3.6.8 & Above:

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 INSTALL!
(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.

Magnumutz 12-10-2008 07:09 PM

w00t, first install :D
Nice hack dude ;)

Leo Brazil 12-11-2008 09:29 AM

Great idea for sure.

Installed.

TandyServices 12-11-2008 09:35 AM

Great work..

Installed

drsli 12-12-2008 12:21 PM

Awesome idea! Thank you much for this enhancement. :) Installed.

Roi Danton 01-16-2009 10:19 AM

Nice one!

Feature request:
Separate "Add Write-In" and "User can change his own vote" for each vote.

Leo Brazil 01-19-2009 08:36 AM

It works good on 3.8.0

Dagothar 02-27-2009 04:09 AM

Excellent! Glad I finally got around to it--and it was an easy install--as we've needed this a long time. Changing votes especially needs to be included in vBulleting.

Installed it on my 3.8.1, finally. Working fine. :)

Thanks! Cheers!

wii 03-06-2009 01:49 PM

Does anyone have a live demo of this ?

Manoel J?nior 03-30-2009 01:13 AM

thanks dude.

Installed

edytwinky 06-29-2009 03:43 PM

Does this mod allow me to allow users to change their vote only?

I really don't want to use the Poll Write-In Part, just the change vote portion.

adnoid 08-22-2009 11:12 AM

Installed and working - thanks. But I've now gotten about a dozen of these:

Code:

Database error in vBulletin 3.8.1:

Invalid SQL:

                DELETE FROM pollvote
                WHERE pollvoteid IN ();

MySQL Error  : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2
Error Number  : 1064
Request Date  : Friday, August 21st 2009 @ 02:21:41 PM
Error Date    : Friday, August 21st 2009 @ 02:21:41 PM
Script        : http://www.websleuths.com/forums/poll.php?do=changevote&pollid=862
Referrer      : http://www.websleuths.com/forums/showthread.php?t=87944
IP Address    : 75.68.55.51
Username      : atherella
Classname    : vB_Database
MySQL Version :

Any idea what conditions could lead to this? What information can I provide to help track this down?

lm3a.net 08-23-2009 10:11 AM

Great !!

thank you,

ryancooper 08-27-2009 01:25 PM

Awesome hack! This should be standard.

Robert9 10-22-2009 10:33 PM

Wunderful!

But two things i really miss:

1. To choose if the answers of a poll should be parsed in alphabetical order.
2. To choose if the result ist sorted by votes and second in alphabetical order, too.

There is another mod that can sort by votes, but it seems that this mod doesnt fit to this one. :(

NTMID8 10-24-2009 04:50 AM

Thanks! Great job! Working good on 3.8.2 with heavy poll modifications done beforehand.

Leo Brazil 01-06-2010 09:58 AM

Working great so far since a long time. Hope to it see ported to 4.0...

edytwinky 01-10-2010 02:09 PM

yes a 4.0 update would be great. I tried messing around with the mod but had no luck

edytwinky 01-29-2010 10:05 PM

FYI. Tried this in 4.0 and received this error:
Quote:

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in [path]/includes/class_bootstrap.php(1111) : eval()'d code on line 69

TomasDR 02-10-2010 03:58 AM

I have been away from the boards for quite a while.

I will be upgrading my board to 4.x so I will be updating this add-on also. Stay tuned.

edytwinky 02-17-2010 10:12 PM

Quote:

Originally Posted by TomasDR (Post 1978853)
I have been away from the boards for quite a while.

I will be upgrading my board to 4.x so I will be updating this add-on also. Stay tuned.


That's great news TomasDR!

Thank you very much. Look forward to it

edytwinky 03-27-2010 06:05 AM

Any update Tomas?

bchertov 07-06-2010 07:13 PM

I'm also interested in a VB 4 version!

na641 07-26-2010 10:09 PM

i am also very interested in a VB4 version

Anti-Liberal10 02-12-2011 01:27 AM

A version for vB 4 coming?

metrika 02-23-2011 03:52 PM

Quote:

Originally Posted by Anti-Liberal10 (Post 2161611)
A version for vB 4 coming?

Same here, very urgent

edytwinky 04-30-2011 02:33 PM

i pm'd the coder to see if he would be able to get a vb4 update

Dennis B 05-24-2011 12:05 PM

It would be awesome if this mod were ported to vb4.

lifanovsky 06-17-2011 11:44 AM

No news? I need this badly. Tough luck..

grey_goose 07-12-2011 09:18 PM

+1 for a vb4 update

lifanovsky 07-15-2011 12:08 PM

Would be nice if there was a vb4 update.

grey_goose 07-24-2011 10:04 PM

I've got this updated for vb4, I sent a PM to the author about sharing it.

NTMID8 07-31-2011 05:55 PM

Quote:

Originally Posted by grey_goose (Post 2224506)
I've got this updated for vb4, I sent a PM to the author about sharing it.

Yes, hopefully you can release this. I would love to have this back on my site.

faraz_hamza 08-02-2011 07:34 PM

me too waiting for vb4 version

grey_goose 08-02-2011 09:02 PM

Sorry I haven't heard any reply :(

Conehead555 09-07-2011 05:57 PM

Quote:

Originally Posted by grey_goose (Post 2228356)
Sorry I haven't heard any reply :(

I think it's fair to post your update for 4.x.x if you give the original credit.

Why should everyone remain in the dark ages because the original guy won't reply?

Please release your hack! :)

edytwinky 09-29-2011 04:01 AM

Quote:

Originally Posted by grey_goose (Post 2228356)
Sorry I haven't heard any reply :(

Have you heard back from Tomas? I was messaging back and forth with him for a while and just sent a PM to him to see what his status was.

Conehead555 11-24-2011 12:21 AM

Someone needs to release an update for this.

Just because someone did it for an older version doesn't mean they should "own" the idea forever and no one else can do it.

That's stupid.

edytwinky 12-18-2011 02:43 PM

Quote:

Originally Posted by Conehead555 (Post 2271334)
Someone needs to release an update for this.

Just because someone did it for an older version doesn't mean they should "own" the idea forever and no one else can do it.

That's stupid.

+1

Totally agree

ravenscape 01-24-2012 08:13 PM

My crack team of quality assurance testers discovered almost immediately that the write-in poll options are not governed by the max size for poll options that you set in the admin panel vbulletin options.

They did this by posting the entire chapter of Genesis into an option. It truncated at Chapter 20, which is just a tad longer than the 150 characters specified in the admin panel.

I've modified the write-in vote template to substring $optionvalue to the desired length. Does anyone know what variable name the specified max poll options characters is stored in? Ideally, I'd like to use that variable rather than hard-coding or creating a new variable that I have to maintain.

Thanks!


All times are GMT. The time now is 06:06 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01388 seconds
  • Memory Usage 1,830KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete