[2.0.11] Colour on poll results

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
15
60%
Very Good
3
12%
Good
5
20%
Fair
2
8%
Poor
0
No votes
 
Total votes: 25

User avatar
M.O.B.
Registered User
Posts: 927
Joined: Tue Jan 04, 2005 1:07 am
Location: San Diego CA USA
Contact:

Post by M.O.B. » Thu Apr 14, 2005 9:01 pm

This is an excellent MOD! Thanks!

Below I included an EasyMOD version that will work well if in case you also installed Admin Voting 1.1.8 before installing this MOD.

Just want to let you know that most templates usually point to their own gif images. What you should do is just rename the template in the install file below so it points to your template or if you have both subSilver and other Template(s), then you should make all templates point to the subSilver gif images directory. (This is what I did since I have both subSilver and Odyssey on my site.) :D

Code: Select all

#############################################################
## MOD Title: Colour on poll results
## MOD Author: Manipe < admin@manipef1.com > (N/A) http://www.manipef1.com 
## MOD Description: Instead of the standard results images on the poll results, this hack shows colour on the results of a poll. Different colours are given to each range of percentages. Also it gives a certain colour to the option that you voted for (Default= Purple)
## MOD Version: 1.1.1 
## 
## Installation Level: Easy
## Installation Time: ~5 Minutes 
## Files To Edit: 
##		viewtopic.php
##		templates/subSilver/viewtopic_poll_result.tpl
##		posting.php
##
## Included Files: 
##		update_to_1.1.1.txt
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: 
## 
##	If you previously installed version 1.0.3 of this MOD, use update_to_1.1.1.txt to update this MOD to the most recent version
##	
############################################################## 
## MOD History: 
##
##
##   2004-12-09 - Version 1.1.1
##      - Forgot to add the code in posting.php
##
##   2004-12-03 - Version 1.1.0
##      - Added a function so that the option that you voted for is given a specific colour
##
##   2004-09-05 - Version 1.0.3
##      - Minor error fixed
##
##   2004-09-04 - Version 1.0.2
##      - Minor error fixed
##
##   2004-08-25 - Version 1.0.1
##      - Some bugs fixed
##
##   2004-08-14 - Version 1.0.0
##      - MOD created
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
##############################################################
# 
#-----[ SQL ]-------------------------------------------
# 
ALTER TABLE phpbb_vote_voters ADD vote_option_id mediumint( 8 ) NULL 

# 
#-----[ OPEN ]--------------------------------------------- 
# 
viewtopic.php

#
#-----[ FIND ]---------------------------------------------
#		
		if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED )
		{

#
#-----[ AFTER, ADD ]---------------------------------------------
# 
// Colour on Poll Results MOD, By Manipe (Begin)
			$sql1 = "SELECT vote_option_id 
				FROM " . VOTE_USERS_TABLE . " 
				WHERE vote_user_id = '" . $userdata['user_id'] . "' 
				AND vote_id = '" . $vote_id . "'";
			if ( !($result1 = $db->sql_query($sql1)) )
			{
			 	message_die(GENERAL_ERROR, 'Could not obtain user voted information', '', __LINE__, __FILE__, $sql);
			}
			$row1 = $db->sql_fetchrow($result1);
			$voted_option_id =  $row1['vote_option_id'];
			$db->sql_freeresult($result1);
// Colour on Poll Results MOD, By Manipe (End)

#
#-----[ FIND ]---------------------------------------------
# 
				$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
				$vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']);

				$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
				$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;

#
#-----[ REPLACE WITH ]---------------------------------------------
# 
// Colour on Poll Results MOD, By Manipe (Begin)
				$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0; 
				$vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']);
// Colour on Poll Results MOD, By Manipe (End)

#
#-----[ FIND ]---------------------------------------------
# 
				if ( count($orig_word) )
				{
					$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
				}

#
#-----[ AFTER, ADD ]---------------------------------------------
# 
// Colour on Poll Results MOD, By Manipe (Begin)
				if ($voted_option_id == ($i+1)){
					$vote_color = 'purple';
				}
				else{
					if ( $vote_percent <= 0.3 ){
						$vote_color = 'green';
					}
					else if ( ($vote_percent > 0.3) && ($vote_percent <= 0.6) ){
						$vote_color = 'blue';
					}
					else if ( $vote_percent > 0.6 ){
						$vote_color = 'red';
					}
				}
// Colour on Poll Results MOD, By Manipe (End)

#
#-----[ FIND ]---------------------------------------------
# 
				$template->assign_block_vars("poll_option", array(
					'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'],
					'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'],
					'POLL_OPTION_PERCENT' => sprintf("%.1d%%", ($vote_percent * 100)),

#
#-----[ AFTER, ADD ]---------------------------------------------
# 
// Colour on Poll Results MOD, By Manipe (Begin)
					'POLL_OPTION_COLOR' => $vote_color,
// Colour on Poll Results MOD, By Manipe (End)

# 
#-----[ OPEN ]--------------------------------------------- 
# 
posting.php

#
#-----[ FIND ]---------------------------------------------
# 
				$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip, vote_cast) 
					VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip', $vote_option_id)";

#
#-----[ REPLACE WITH ]---------------------------------------------
# 
// Colour on Poll Results MOD, By Manipe (Begin)
				$sql = "INSERT INTO " . VOTE_USERS_TABLE . " (vote_id, vote_user_id, vote_user_ip, vote_cast, vote_option_id) 
					VALUES ($vote_id, " . $userdata['user_id'] . ", '$user_ip', '$vote_option_id')";
// Colour on Poll Results MOD, By Manipe (End)

# 
#-----[ OPEN ]--------------------------------------------- 
# 
templates/subSilver/viewtopic_poll_result.tpl

#
#-----[ FIND ]---------------------------------------------
# 
					<td><img src="templates/subSilver/images/vote_lcap.gif" width="4" alt="" height="12" /></td>
					<td><img src="{poll_option.POLL_OPTION_IMG}" width="{poll_option.POLL_OPTION_IMG_WIDTH}" height="12" alt="{poll_option.POLL_OPTION_PERCENT}" /></td>
					<td><img src="templates/subSilver/images/vote_rcap.gif" width="4" alt="" height="12" /></td>

#
#-----[ REPLACE WITH ]---------------------------------------------
# 
					<td width="{poll_option.POLL_OPTION_IMG_WIDTH}" height="12" bgcolor="{poll_option.POLL_OPTION_COLOR}"><IMG src="images/spacer.gif" height="12"></td>

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 

# EoM
Image

aeryk
Registered User
Posts: 6
Joined: Fri Sep 16, 2005 10:39 pm

Post by aeryk » Sat Sep 17, 2005 1:27 pm

getting error message with poll submit for all users:

Could not insert user_id for poll

DEBUG MODE

INSERT INTO phpbb_vote_voters (vote_id, vote_user_id, vote_user_ip, vote_option_id) VALUES (2, 4, '424376f9', '11')

Line : 500
File : .../posting.php


SQL had been created for this mod...

User avatar
Arcadius
Registered User
Posts: 5
Joined: Tue Sep 27, 2005 6:42 pm

Post by Arcadius » Mon Oct 10, 2005 3:24 am

I installed this mod and everything looks fine but I am currently not able to see the colored bars. I can see little marks where the ends of the bars are supposed to be, but no colored bars themselves. This is using a near black background. Any help?

sledcrew
Registered User
Posts: 8
Joined: Wed Apr 06, 2005 4:29 am

Post by sledcrew » Tue Oct 25, 2005 11:11 pm

Sry.. about this...


I figured it out...

I Should try most stuff before wasting you peoples time..

THanks anyways.

KandelCK1
Registered User
Posts: 19
Joined: Fri Nov 11, 2005 10:55 pm

Post by KandelCK1 » Sat Jan 28, 2006 2:16 am

Does this work with 2.0.17?

Manipe
Former Team Member
Posts: 1146
Joined: Thu Jul 22, 2004 6:30 pm
Location: Éire
Contact:

Post by Manipe » Sat Jan 28, 2006 1:10 pm

KandelCK1 wrote: Does this work with 2.0.17?

It should. BTW, you should update to the latest version, 2.0.19.
Go to the downloads page to get a package to update.
My MODs: [ Topics a user has started ] , [ Profile views ] , [ Colour on poll results ] , [ Topic posters ] , [ Add number to PM ] , [ Default avatar ] , [ View category name ] , [ Null vote ] , [ Forum description in viewforum ] , [ Resync forum ids ] , [ View PM while replying ] , [ Quick poll insert ] , [ Limit login attempts ] , [ Track PMs ]

www.ManipeF1.com

User avatar
shadav
Registered User
Posts: 141
Joined: Thu Dec 01, 2005 7:12 pm
Location: Drowning In Corn Fields
Contact:

Post by shadav » Tue Feb 07, 2006 6:13 pm

I'm using easymod to try and install and it's given me a warning...
1 Warning(s) reported by the SQL Parser

1. Missing semicolon, it might be an indication of further syntax errors, statement: 1


will this be a problem?

Manipe
Former Team Member
Posts: 1146
Joined: Thu Jul 22, 2004 6:30 pm
Location: Éire
Contact:

Post by Manipe » Tue Feb 07, 2006 7:56 pm

shadav wrote: I'm using easymod to try and install and it's given me a warning...
1 Warning(s) reported by the SQL Parser

1. Missing semicolon, it might be an indication of further syntax errors, statement: 1


will this be a problem?

No not at all. That only becomes a problem when more than one SQL statement are executed in the same string.

The new SQL parser can be picky about that, but just run the MOD as normal.
My MODs: [ Topics a user has started ] , [ Profile views ] , [ Colour on poll results ] , [ Topic posters ] , [ Add number to PM ] , [ Default avatar ] , [ View category name ] , [ Null vote ] , [ Forum description in viewforum ] , [ Resync forum ids ] , [ View PM while replying ] , [ Quick poll insert ] , [ Limit login attempts ] , [ Track PMs ]

www.ManipeF1.com

User avatar
shadav
Registered User
Posts: 141
Joined: Thu Dec 01, 2005 7:12 pm
Location: Drowning In Corn Fields
Contact:

Post by shadav » Tue Feb 07, 2006 9:21 pm

ok thank you :)

User avatar
shadav
Registered User
Posts: 141
Joined: Thu Dec 01, 2005 7:12 pm
Location: Drowning In Corn Fields
Contact:

Post by shadav » Tue Feb 07, 2006 9:22 pm

[edit] sorry double posted...pc locked up

n0ia
Registered User
Posts: 1
Joined: Tue Feb 21, 2006 10:33 pm

Post by n0ia » Tue Feb 21, 2006 10:39 pm

I've made some different color vote_lcap.gif, vote_rcap.gif, and voting_bar.gif images if anyone is interested.

I just copied the original, duplicated the layer and did a color overlay of the following:

Red
Blue
Green
Yellow
Purple
Turqoise
Pink

They are PNG images saved with a .gif extension so that they render the transparency correct. Let me know if anyone wants this and I'll give you a link or send it to someone to host.

Manipe
Former Team Member
Posts: 1146
Joined: Thu Jul 22, 2004 6:30 pm
Location: Éire
Contact:

Post by Manipe » Wed Feb 22, 2006 4:14 pm

n0ia wrote: I've made some different color vote_lcap.gif, vote_rcap.gif, and voting_bar.gif images if anyone is interested.

I just copied the original, duplicated the layer and did a color overlay of the following:

Red
Blue
Green
Yellow
Purple
Turqoise
Pink

They are PNG images saved with a .gif extension so that they render the transparency correct. Let me know if anyone wants this and I'll give you a link or send it to someone to host.

Actually, I once started making images like that, but decided against it because my designing skills have a lot to be desired.

Anyway, to cut a long story short, would you like me to introduce them in the package. I would like to have them as it would look better instead of just having colour backgrounds.
Please let me know how you feel.
My MODs: [ Topics a user has started ] , [ Profile views ] , [ Colour on poll results ] , [ Topic posters ] , [ Add number to PM ] , [ Default avatar ] , [ View category name ] , [ Null vote ] , [ Forum description in viewforum ] , [ Resync forum ids ] , [ View PM while replying ] , [ Quick poll insert ] , [ Limit login attempts ] , [ Track PMs ]

www.ManipeF1.com

rohit4all
Registered User
Posts: 28
Joined: Mon Apr 17, 2006 1:32 pm

Post by rohit4all » Thu Apr 20, 2006 6:31 pm

Manipe wrote:
rimski wrote:Hi

I have tried to install the colour mod to my forum but I get an error message so have now reverted to the pre install forum.
But could someone just quickly explain what the following code in the instructions mean

#
#-----[ SQL ]-------------------------------------------
#
ALTER TABLE phpbb_vote_voters ADD vote_option_id mediumint( 8 ) NULL


Well basically you have to add the column "vote_option_id" to the "phpbb_vote_voters" table.

You can do it through PhpMyAdmin.



Hey I am newbie, Can u explain it from scratch ?

Manipe
Former Team Member
Posts: 1146
Joined: Thu Jul 22, 2004 6:30 pm
Location: Éire
Contact:

Post by Manipe » Thu Apr 20, 2006 7:57 pm

Do you have phpMyAdmin?
My MODs: [ Topics a user has started ] , [ Profile views ] , [ Colour on poll results ] , [ Topic posters ] , [ Add number to PM ] , [ Default avatar ] , [ View category name ] , [ Null vote ] , [ Forum description in viewforum ] , [ Resync forum ids ] , [ View PM while replying ] , [ Quick poll insert ] , [ Limit login attempts ] , [ Track PMs ]

www.ManipeF1.com

rohit4all
Registered User
Posts: 28
Joined: Mon Apr 17, 2006 1:32 pm

Post by rohit4all » Thu Apr 20, 2006 8:54 pm

Yes I have . But I do not know how to create column .

Post Reply

Return to “[2.0.x] MOD Database Cleanup”