[ABD] Hide Poll Results

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
Litos
Registered User
Posts: 26
Joined: Sat Oct 06, 2007 2:35 am

[ABD] Hide Poll Results

Post by Litos » Sat Oct 06, 2007 1:12 pm

MOD Title: Hide Poll Results
MOD Description: Hides the results of polls with a time limit until the poll has ended.
MOD Version: 0.1.2

MOD Download: http://home.arcor.de/schredder7/HidePol ... _0.1.2.zip

This mod hides the results of a poll with a time limit, so that users aren't influenced by previous votes.

New in 0.1.2: Some people encountered a bug that prevented them from starting new threads without a poll. This should be fixed now.

It includes support for English and German language and for the proSilver and subsilver2 styles.

That's what it looks like:
with proSilver
with subsilver2

I'd be glad about any feedback.

Note: Do not use Windows Notepad to edit PHP files!
This isn't specific to this mod, but since many people make that mistake, I'll explain it here to avoid any confusion. Notepad adds a Byte Order Mark (BOM) at the beginning of every utf-8 encoded file. These are three bytes which are supposed to tell the application reading the file that it encoded in utf-8 and not ASCII or some other encoding.
While this isn't strictly wrong, it's not necessary either and most editors don't do it or at least have an option for turning it off. In normal text files, it is not harmful, but it has quite devastating effects when put in a php file: PHP considers this as normal text, and since it comes before the initial <?php tag, it will be sent as out as output as it is. If this happens in a php file that was included by some other file, the BOM will appear somewhere in the middle of the created document. Most browser get confused by that (afaik only Opera can handle this). Even worse, you can no longer set custom html header information once output has been sent (which phpBB needs to do).
Long story short: BOM in php files is very, very bad. Use a different editor, like Notepad++ and make sure that you save the file as utf-8 without BOM.
Last edited by DavidIQ on Tue Dec 01, 2009 1:32 am, edited 5 times in total.
Reason: Marked as abandoned

RedTrinity
Registered User
Posts: 1327
Joined: Sat May 06, 2006 3:32 am

Re: [BETA] Hide Poll Results

Post by RedTrinity » Sat Oct 06, 2007 2:26 pm

Sounds great!

I will install it tomorrow morning and let you know how I go :)

Cheers,

Nikki.

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: [BETA] Hide Poll Results

Post by ChriZathens » Sat Oct 06, 2007 9:18 pm

Hi there...
Nice and useful idea !! ;)
I seem to have a prob, though...
I installed it, but it does not seem to work
When I enter a poll with 5 option and submit the post I get this result:
Image
Click Image to Enlarge

And after voting for option1 I get this result:
Image
Click Image to Enlarge

You also have a small error in your xml file. It writes:

Code: Select all

Code: Select All
		$template->assign_block_vars('poll_option', array(
			'POLL_OPTION_ID' 		=> $poll_option['poll_option_id'],
			'POLL_OPTION_CAPTION' 	=> $poll_option['poll_option_text'],
			'POLL_OPTION_RESULT' 	=> $poll_option['poll_option_total'],
			'POLL_OPTION_PERCENT' 	=> $option_pct_txt,
			'POLL_OPTION_PCT'		=> round($option_pct * 100),
			'POLL_OPTION_IMG' 		=> $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
			'POLL_OPTION_VOTED'		=> (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
		);
And right after that :

Code: Select all

Code: Select All
		if($s_hide_results)
		{
			$template->assign_block_vars('poll_option', array(
				'POLL_OPTION_ID' 		=> $poll_option['poll_option_id'],
				'POLL_OPTION_CAPTION' 	=> $poll_option['poll_option_text'],
				'POLL_OPTION_RESULT' 	=> '?',
				'POLL_OPTION_PERCENT' 	=> '?',
				'POLL_OPTION_PCT'		=> round($option_pct * 0),
				'POLL_OPTION_IMG' 		=> $user->img('poll_center', '?', round($option_pct * 0)),
				'POLL_OPTION_VOTED'		=> (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
			);
		}
		else
		{
			$template->assign_block_vars('poll_option', array(
				'POLL_OPTION_ID' 		=> $poll_option['poll_option_id'],
				'POLL_OPTION_CAPTION' 	=> $poll_option['poll_option_text'],
				'POLL_OPTION_RESULT' 	=> $poll_option['poll_option_total'],
				'POLL_OPTION_PERCENT' 	=> $option_pct_txt,
				'POLL_OPTION_PCT'		=> round($option_pct * 100),
				'POLL_OPTION_IMG' 		=> $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
				'POLL_OPTION_VOTED'		=> (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
			);
		}
(It doesn't say whether to add before or after)

Also:
I thought that there should be an option in poll creation to hide the results but there isn't..
As far as I understand it hides every poll with a time limit option. If you could make it so that you can select whether you want the results to be hidden or not, then it would be much better ;)
(Just my opinion)
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

User avatar
Litos
Registered User
Posts: 26
Joined: Sat Oct 06, 2007 2:35 am

Re: [BETA] Hide Poll Results

Post by Litos » Sat Oct 06, 2007 11:37 pm

Oh, I'm sorry, there was an error in the xml file. You should replace the first code segment with the second. I just fixed that in the xml file.

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: [BETA] Hide Poll Results

Post by ChriZathens » Sun Oct 07, 2007 12:05 am

Ok, then I assume that's why I was getting this strange result...
I tried adding after, adding before, but not replacing.. :D
I'll try it again and post the results !!!
Nice work!!! ;)

EDIT: OK, it works fine !!!
Will you consider adding a switch to make the hide result function optional?
It's more handy this way, since you don't need all the polls results to be hidden... ;)
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

RedTrinity
Registered User
Posts: 1327
Joined: Sat May 06, 2006 3:32 am

Re: [BETA] Hide Poll Results

Post by RedTrinity » Sun Oct 07, 2007 3:19 am

ChriZathens wrote: Will you consider adding a switch to make the hide result function optional?
It's more handy this way, since you don't need all the polls results to be hidden... ;)
I agree with this suggestion :)

Otherwise I have also installed it now and it works perfectly, nice work Litos! :)

User avatar
Litos
Registered User
Posts: 26
Joined: Sat Oct 06, 2007 2:35 am

Re: [BETA] Hide Poll Results

Post by Litos » Sun Oct 07, 2007 2:04 pm

Thank you, I'm glad it works! :-D

I'll see what I can do about the switch.

User avatar
Litos
Registered User
Posts: 26
Joined: Sat Oct 06, 2007 2:35 am

Re: [BETA] Hide Poll Results

Post by Litos » Sun Oct 07, 2007 11:24 pm

I've just uploaded a new version. Now, a checkbox should appear when creating a new poll (or editing an existing one) where you can choose whether the results should be hidden or not.

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: [BETA] Hide Poll Results

Post by ChriZathens » Mon Oct 08, 2007 9:22 am

Nice !!!
Just tested it and seems to work just fine !!!
Nice work, Litos, congrats again !!!!
A must-have mod !!!! ;)
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

User avatar
CrimsonThunder
Registered User
Posts: 340
Joined: Sun Sep 02, 2007 10:18 am

Re: [BETA] Hide Poll Results

Post by CrimsonThunder » Wed Oct 10, 2007 4:26 am

Sounds great, I was just looking for this too. >_> Got it from a google search. :P

Just wondering if theres a possibility to make it so only Admins can create these polls?

User avatar
ChriZathens
Registered User
Posts: 1477
Joined: Tue Apr 18, 2006 9:11 pm
Location: Athens, Greece
Name: Chris

Re: [BETA] Hide Poll Results

Post by ChriZathens » Wed Oct 10, 2007 9:07 am

CrimsonThunder wrote:Sounds great, I was just looking for this too. >_> Got it from a google search. :P

Just wondering if theres a possibility to make it so only Admins can create these polls?
Try this:
Open styles/prosilver/template/posting_poll_body.html
Find:

Code: Select all

		<hr class="dashed" />

		<dl>
			<dt><label for="poll_hide_results">{L_POLL_HIDE_RESULTS}:</label></dt>
			<dd><label for="poll_hide_results"><input type="checkbox" id="poll_hide_results" name="poll_hide_results"{HIDE_RESULTS_CHECKED} /> {L_POLL_HIDE_RESULTS_EXPLAIN}</label></dd>
		</dl>
			
Replace with:

Code: Select all

<!-- IF U_ACP -->
		<hr class="dashed" />

		<dl>
			<dt><label for="poll_hide_results">{L_POLL_HIDE_RESULTS}:</label></dt>
			<dd><label for="poll_hide_results"><input type="checkbox" id="poll_hide_results" name="poll_hide_results"{HIDE_RESULTS_CHECKED} /> {L_POLL_HIDE_RESULTS_EXPLAIN}</label></dd>
		</dl>
<!-- ENDIF -->
Open: styles/subsilver2/template/posting_poll_body.html
Find

Code: Select all

<tr>
	<td class="row1"><b class="genmed">{L_POLL_HIDE_RESULTS}:</b><br /><span class="gensmall">{L_POLL_HIDE_RESULTS_EXPLAIN}</span></td>
	<td class="row2"><input type="checkbox" class="radio" name="poll_hide_results"{HIDE_RESULTS_CHECKED} /></td>
</tr>
Replace with

Code: Select all

<!-- IF U_ACP -->
<tr>
	<td class="row1"><b class="genmed">{L_POLL_HIDE_RESULTS}:</b><br /><span class="gensmall">{L_POLL_HIDE_RESULTS_EXPLAIN}</span></td>
	<td class="row2"><input type="checkbox" class="radio" name="poll_hide_results"{HIDE_RESULTS_CHECKED} /></td>
</tr>
<!-- ENDIF -->

This will - hopefully- make the option to hide the results viewable only to admins...

Please post the results here..
My mods in MODDB:
Add Homepage link in header - Change user activity post limit - Post number in viewtopic
If you need support click on the support tab there and post your question.
Do not PM me - chances of viewing my PMs are way thinner than viewing the support question in the customization DB...

User avatar
CrimsonThunder
Registered User
Posts: 340
Joined: Sun Sep 02, 2007 10:18 am

Re: [BETA] Hide Poll Results

Post by CrimsonThunder » Sat Oct 13, 2007 10:33 am

First of all thanks Litos for the mod. ;) And ChriZathens for helping me. :) (I will test it in a second) Edit: Worked perfectly!! :D

All that I have to say is that it should be allowed that Admins and Mods can view the results! :D (And perhaps the topic creator) And that "Total Votes: *Amount*" should be un-viewable. If thats possible. :)

Maybe a "Make infinate private poll" just for those occations where you want no one else to know the results of a poll. This would of course need it so the admin can see it. ^^;

RedTrinity
Registered User
Posts: 1327
Joined: Sat May 06, 2006 3:32 am

Re: [BETA] Hide Poll Results

Post by RedTrinity » Wed Oct 24, 2007 10:51 pm

CrimsonThunder wrote: All that I have to say is that it should be allowed that Admins and Mods can view the results! :D (And perhaps the topic creator) And that "Total Votes: *Amount*" should be un-viewable. If thats possible. :)

Maybe a "Make infinate private poll" just for those occations where you want no one else to know the results of a poll. This would of course need it so the admin can see it. ^^;
I 2nd these suggestions, especially those in regards to admin/moderators being able to see results regardless.

User avatar
Litos
Registered User
Posts: 26
Joined: Sat Oct 06, 2007 2:35 am

Re: [BETA] Hide Poll Results

Post by Litos » Tue Oct 30, 2007 10:13 pm

At the moment, I don't really have the time to work on the mod. Once I find some more spare time, I want to add an option for the admin to choose whether the total number of votes should be hidden as well and maybe (if this is possible) an option to prevent the editing of polls while they are hidden. Those were the features I wanted to add before submitting it to the mod database.

Allowing admins and mods to view the results is something which I definitely don't want in my forum, so unless I really have a lot of time and nothing else to do, I probably won't work in that direction. However, this is mod is under the GPL, so anyone is welcome to implement these changes themselves. ;-)

User avatar
CrimsonThunder
Registered User
Posts: 340
Joined: Sun Sep 02, 2007 10:18 am

Re: [BETA] Hide Poll Results

Post by CrimsonThunder » Wed Oct 31, 2007 3:12 am

Litos wrote:At the moment, I don't really have the time to work on the mod. Once I find some more spare time, I want to add an option for the admin to choose whether the total number of votes should be hidden as well and maybe (if this is possible) an option to prevent the editing of polls while they are hidden. Those were the features I wanted to add before submitting it to the mod database.

Allowing admins and mods to view the results is something which I definitely don't want in my forum, so unless I really have a lot of time and nothing else to do, I probably won't work in that direction. However, this is mod is under the GPL, so anyone is welcome to implement these changes themselves. ;-)
I don't know how too. :(

Locked

Return to “[3.0.x] Abandoned MODs”