PDA

View Full Version : Hide Poll Results


Scott MacVicar
01-11-2002, 10:00 PM
Firefly has a hardcoded version of this for hacker of the month, it allows the original poll poster, admins and mods of that form to view the results of the poll and none of the regular users. They can only view the poll if the poll is closed either by a admin/mod or the poll ends.

Relatively simple install, just two templates and two php files, though editing poll.php will be one of the more lengthy tasks.

This was tested on vB 2.2.6 and won't work without some editing on versions before as the multiple choice poll was introduced in the 2.2.x series and there is some reference to this in the queries, if you remove the references to these it should work.

Lesane
01-12-2002, 10:26 AM
Great, gonna install this one later. Thanks

bokhalifa
01-12-2002, 12:28 PM
good hack Great :)

TheComputerGuy
01-12-2002, 06:03 PM
sweet, thanks will do this for sure

Psychdrone
01-12-2002, 11:48 PM
are you able to set it to on or off, or to indivisual polls?

Scott MacVicar
01-13-2002, 01:34 AM
When you post a poll there will be a tick box which allows you to select if the poll results are hidden or not.

Hoffi
01-20-2002, 10:14 PM
It works not correctly.
In the Moment Users can't see the Polls. But Guests can see them. In this Forum Guests has no Admittance to vote on Polls. But when they Click on "View" they see it.

If you want to see it, look in the Forum in my Sig. It's in German. You can see a Sample in "Verein", the 2nd Forum.

WizyWyg
02-13-2002, 05:01 PM
Is there anyway to NOT show the "bars" and jsut put a message saying :

"Thank you for voting, results will be posted at a later time" or something like that?

what part on Poll.php can I edit so the bars wont show.

M.Smith
02-13-2002, 05:28 PM
thanx Scott,
needed this one and im gonna install it later!
BTW: i doubt u know who i am but on your forums im called TiNmAn!!! :china:

WizyWyg
02-14-2002, 05:55 PM
Anyway to not show the "0%" results but show instead a message saying "Thanks for voting; results will be shown at the closing of this poll".

I think its "unnecessary" to show the "results" if its just going to remain at 0% when you "hide" the results.

Which template/php file must I edit to change this?

Brian Cruz
03-17-2002, 10:58 PM
I'm having two problems with this hack.

First, anyone who hasn't voted can click on "View Results" and get the results of the poll. It only shows 0% on all choices for someone who has already voted.

Second, when a poll has been set to be hidden, and you go to edit it, the "hidden" box is not checked. So there's no way for me to know if a poll is hidden or not, cause as the admin I always see the results anyway.

If those two problems could be fixed, this would be a great hack.

Scott MacVicar
03-18-2002, 08:30 PM
will look into the first thing now as this is quite an important problem

rascal
05-08-2002, 01:32 PM
Has the problem as per Brian been resolved yet?

nighteyes
05-26-2002, 03:35 PM
As rascal asked. Has it?

Scott MacVicar
05-26-2002, 03:56 PM
Yeah it was updated, it was due to a wrong variable name that was causing people to be able to view the poll results when they clicked Show Results, $thread needed to be changed to $threadinfo within poll.php

And the checked thing was due to a missing bit of code which has also been sorted.

nighteyes
05-27-2002, 05:40 AM
Thanks for replying. Before I attempt to add this hack - is all the updated/fixed code in the attached text file at the top of this thread?

Scott MacVicar
05-27-2002, 12:29 PM
yes it is.

BillaBongUSA
06-30-2002, 04:42 AM
Hm... I get the following error:

Parse error: parse error, unexpected T_VARIABLE in /home/username/public_html/forums/poll.php on line 396

I'm running vBulletin 2.2.6...

BillaBongUSA
06-30-2002, 07:18 PM
Ah, I just took a look at Poll.php from version 2.2.2, and Poll.php from version 2.2.6, and I hadn't realized that they had changed so much. Would you be willing to modify this hack to work with version 2.2.6? Thanks either way.

Scott MacVicar
06-30-2002, 09:24 PM
Sorted for 2.2.6

BillaBongUSA
06-30-2002, 11:26 PM
Hey, thanks alot :D. But there's that problem that if you click on "View Results" before you vote, you can see the results.

BillaBongUSA
06-30-2002, 11:44 PM
Oh, nevermind, I just read your post on the first page about changing $thread to $threadinfo. Thanks again! :)

WizyWyg
10-10-2002, 07:17 PM
Is there a way to HIDE the results even from the ADMINS of the board as well as those who created the poll. I want to have it so the results remain anonymous to everyone (including admins and tbose who created the poll) until it ends or the admin closes the poll.

Link14716
10-10-2002, 09:17 PM
If an admin wanted to see it, all they'd have to do is hit "Edit Poll" which defeats that purpose :)

Phillip Chapman
12-11-2002, 08:13 PM
I'm working on installing this hack and it appears my poll.php file doesn't contain the following which needs to be changed...

if ($option[votes] == 0) {
$option[percent]=0;
} else{
$option[percent] = number_format($option[votes]/$pollinfo[numbervotes]*100,2);
}

Am I missing something? Or because I'm running vBulletin 2.2.9 is this change no longer necessary?

This is the first hack I've installed, so please be as detailed as posssible.

Phillip Chapman
12-12-2002, 01:42 PM
Ok... I was able to install the hack. However, now whenever I post a poll I'm getting the following error...

Database error in vBulletin 2.2.9:

Invalid SQL: INSERT INTO poll (pollid,question,dateline,options,votes,active,num beroptions,timeout,multiple,hidepoll) VALUES (NULL,'What is your favorite non-Muppet series of characters?','1039707446','Looney Tunes|||Peanuts|||Disney|||Hanna-Barbara|||Nick Toons','0|||0|||0|||0|||0',1,5,'7','0','0')
mysql error: Unknown column 'hidepoll' in 'field list'

mysql error number: 1054

Date: Thursday 12th of December 2002 08:37:26 AM
Script: http://forum.muppetcentral.com/poll.php
Referer: http://forum.muppetcentral.com/poll.php


Can anyone please help with this?

Phillip Chapman
12-12-2002, 08:30 PM
Think I finally got everything working now. :classic:

Phillip Chapman
02-21-2003, 07:44 PM
I'm needing to uninstall this hack. It works fine, we just want to have a totallly clean board and database. Obviously, I just overwrite the original php files.

My question is, how do I remove an SQL Query from the database under PHP admin? The code I added was...

ALTER TABLE `poll` ADD `hidepoll` SMALLINT(5) UNSIGNED NOT NULL AFTER `voters`

Exactly, what do I need to do to remove this from the database? (I understand it may not be totally necessary to remove this but I want to be sure it is gone and there are no future issues with this code).

Thanks in advance for your help!

Boofo
02-21-2003, 08:20 PM
Scott, in the following code from your file, is this supposed to be $thread['postuserid'] or $threadinfo['postuserid']?

----------------------
showthread.php
----------------------
look for the following on line 294
$pollbits="";

below it add
$noshow = 0;
if($pollinfo['hidepoll'] && $bbuserinfo['usergroupid'] != 6 && $thread['postuserid'] != $bbuserinfo['userid'] && !ismoderator($thread[forumid],"caneditposts")) {
$noshow = 1;
}

Threshold
08-01-2003, 07:57 PM
1) The thread notes that you made some changes to the original. Are those changes in the .txt file that is part of the first post?

2) At the beginning of the instructions, there are some steps for people who are using verions 2.0.x. Where do those instructions end and where do the instructions begin for people using later versions? (I am running 2.3.0).

Is this step for people on version 2.0.x ? ==>


Run the sql query to add the column to the poll table so users can select to hide the poll or not
ALTER TABLE `poll` ADD `hidepoll` SMALLINT(5) UNSIGNED NOT NULL AFTER `voters`

tanhadil
05-24-2004, 02:44 PM
this works on vb2.3??

Edison Chen
06-10-2004, 07:38 AM
Installed and works perfectly. ;) And I'm using 2.3.5.

jndeakin
09-08-2005, 07:39 AM
Anything like this around for vBulletin 3.x.x?

Jim