[DISC] Forum Statistics In Signature

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Brimz
Registered User
Posts: 78
Joined: Mon Oct 13, 2003 11:49 pm

Post by Brimz »

Brimz wrote: Hey I know this topic is old, but when I change the $tc's RGB, it doesn't work. The text just stays as an average of all the colors put together (I think). Help please?
O.o : I may be wrong, but does it honestly matter? : o.O
Brimz
Registered User
Posts: 78
Joined: Mon Oct 13, 2003 11:49 pm

Post by Brimz »

Please guys, it's really important.
O.o : I may be wrong, but does it honestly matter? : o.O
Donnie-D
Registered User
Posts: 268
Joined: Tue Aug 19, 2003 1:58 am
Contact:

Post by Donnie-D »

@brimz

in the .PHP file

Find this
Code:
$tc = ImageColorAllocate ($im, 0, 0, 0);


Change the 0, 0, 0 into anything you want

Example

White 255, 255, 255
Red 255, 0, 0
Yellow 255, 255, 0
Green 0, 255, 0
Bleu 0, 0, 255


going 1 page back, costs less time than posting!
Brimz
Registered User
Posts: 78
Joined: Mon Oct 13, 2003 11:49 pm

Post by Brimz »

I know, but as I said it doesn't work.
O.o : I may be wrong, but does it honestly matter? : o.O
Brimz
Registered User
Posts: 78
Joined: Mon Oct 13, 2003 11:49 pm

Post by Brimz »

Nevermind, the color pallete was too small, thanks anyways :? .

Is there anyways of changing the font face on it though?
O.o : I may be wrong, but does it honestly matter? : o.O
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

Space Penguin wrote: This is the code I used based on the viewprofile.php entries, it probably isn't very efficient and has a few bits of unessicary code but I have never done anything before, this is the code as I put it in my signature.php


I have been looking for something like this for a while. Thanks for coding it. A couple of questions:

1. What is the "level" value? Mine turns out to be 26 but I have no idea what that means.

2. Is there a way to reduce the post percentage to only a couple of digits after the decimal point? Mine is currently 2.5861294860666 %

3. Did you find out how to set the background parameter?
User avatar
ArchY
Registered User
Posts: 42
Joined: Sat Nov 03, 2001 10:34 am
Location: Saint Germain en Laye

Post by ArchY »

very cool mod ;) THX
Brimz
Registered User
Posts: 78
Joined: Mon Oct 13, 2003 11:49 pm

Post by Brimz »

Quinn1981 wrote: Works pretty well. No need for a cached image... most definately since it shows users online.

I modified mine to show everyone online instead of just the users.

What'd you change what to?
O.o : I may be wrong, but does it honestly matter? : o.O
User avatar
Cryo
Registered User
Posts: 455
Joined: Tue Oct 21, 2003 5:28 pm
Location: Canada
Name: Chris

Post by Cryo »

Mine is working fine :roll:
"See in this world there's two kinds of people my friend:
those with loaded guns and those who dig"
Clint Eastwood
Acecool
Registered User
Posts: 1013
Joined: Sat Jul 13, 2002 4:51 am
Location: Behind my computer
Contact:

Post by Acecool »

How is this different from the 14 page topic?

Oh well, change the text color to

0xFF,0xFF,0xFF for white

0xHEX_HERE

0x00,0x00,0x00 is black

etc etc
Visit Acecoolco.com :: Image

If you plan on contacting me, please read this: Legal Terms & Conditions
Space Penguin
Registered User
Posts: 152
Joined: Mon Jul 28, 2003 6:57 am
Location: Somewhere Posts: 99999999

Post by Space Penguin »

beggers wrote:
Space Penguin wrote:This is the code I used based on the viewprofile.php entries, it probably isn't very efficient and has a few bits of unessicary code but I have never done anything before, this is the code as I put it in my signature.php


I have been looking for something like this for a while. Thanks for coding it. A couple of questions:

1. What is the "level" value? Mine turns out to be 26 but I have no idea what that means.

2. Is there a way to reduce the post percentage to only a couple of digits after the decimal point? Mine is currently 2.5861294860666 %

3. Did you find out how to set the background parameter?


1. The Level value is from the hp/mp/exp mod I used the equation from that to create an RPG level.

2. Probably but this is my first attempt at coding so I wouldn't know there's probably a charlimit tag or something.

3. Yes indeed I have you need a second variable after the u=1, you need to put &*new variable name*1, for my variable I used bg, so you'd have:

http://www.yourdomain/phpbb2directory/s ... p?u=2&bg=2

The code for it is (note this code shows how to have a three backgrounds, two you can choose from and one is a non variable default one aka if you don't put in a bg= variable)

Code: Select all

<?php 
define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
{
	message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$profiledata = get_userdata(intval($HTTP_GET_VARS[POST_USERS_URL]));
$info = $_GET['bg'];
$people = $_GET['u'];
$user_forum_sql = ( !empty($forum_id) ) ? "AND s.session_page = " . intval($forum_id) : '';
$sql = "SELECT u.username, u.user_id, s.session_logged_in, s.session_ip
	FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
	WHERE u.user_id = s.session_user_id
		AND s.session_time >= ".( time() - 300 ) . "
		$user_forum_sql
	ORDER BY u.username ASC, s.session_ip ASC";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
}
$logged_online = 0;
$prev_user_id = 0;
while( $row = $db->sql_fetchrow($result) )
{
	// User is logged in and therefor not a guest
	if ( $row['session_logged_in'] )
	{
		// Skip multiple sessions for one user
		if ( $row['user_id'] != $prev_user_id )
		{
				$logged_online++;
		}
		$prev_user_id = $row['user_id'];
	}
}
if ( $bg == 1 )
{
$image = "signature2.png"; 
$im = imagecreatefrompng($image); 
$tc  = ImageColorAllocate ($im, 0, 0, 0); 
$red  = ImageColorAllocate ($im, 255, 0, 0); 
$posts = $profiledata['user_posts'];
$username = $profiledata['username'];
$level = floor( pow( log10( $profiledata['user_posts'] ), 3 ) ) + 1; 
$points = $profiledata['user_points'];
$total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
ImageString($im, 3, 148, 2, "*Your Forum Name*", $tc);
ImageString($im, 1, 330, 1, "*your forum URL*", $tc); 
ImageString($im, 3, 148, 15, "$username", $tc); 
if ( $profiledata['user_level'] == 1 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Administrator", $tc); 
				}
else if ( $profiledata['user_level'] == 2 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Moderator", $tc);				}
else if ( $profiledata['user_level'] == 0 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " User", $tc);				}
ImageString($im, 2, 148, 35, "Level: $level", $tc); 
ImageString($im, 2, 148, 45, "Posts: $posts", $tc); 
ImageString($im, 2, 148, 55, "Points: $points", $tc);
ImageString($im, 2, 148, 65, "Post Percentage: $percentage%", $tc); 
header("Content-Type: image/png"); 
Imagepng($im,'',100); 
ImageDestroy ($im); 
}
else if ( $bg == 2 )
{
$image = "signature3.png"; 
$im = imagecreatefrompng($image); 
$tc  = ImageColorAllocate ($im, 255, 255, 255); 
$red  = ImageColorAllocate ($im, 255, 0, 0); 
$posts = $profiledata['user_posts'];
$username = $profiledata['username'];
$level = floor( pow( log10( $profiledata['user_posts'] ), 3 ) ) + 1; 
$points = $profiledata['user_points'];
$total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
ImageString($im, 3, 148, 2, "*Your Forum Name*", $tc);
ImageString($im, 1, 330, 1, "*your forum URL*", $tc); 
ImageString($im, 3, 148, 15, "$username", $tc); 
if ( $profiledata['user_level'] == 1 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Administrator", $tc); 
				}
else if ( $profiledata['user_level'] == 2 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Moderator", $tc);				}
else if ( $profiledata['user_level'] == 0 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " User", $tc);				}
ImageString($im, 2, 148, 35, "Level: $level", $tc); 
ImageString($im, 2, 148, 45, "Posts: $posts", $tc); 
ImageString($im, 2, 148, 55, "Points: $Points", $tc);
ImageString($im, 2, 148, 65, "Post Percentage: $percentage %", $tc); 
header("Content-Type: image/png"); 
Imagepng($im,'',100); 
ImageDestroy ($im); 
}
else
{
$image = "signature.png"; 
$im = imagecreatefrompng($image); 
$tc  = ImageColorAllocate ($im, 0, 0, 0); 
$red  = ImageColorAllocate ($im, 255, 0, 0); 
$posts = $profiledata['user_posts'];
$username = $profiledata['username'];
$level = floor( pow( log10( $profiledata['user_posts'] ), 3 ) ) + 1; 
$points = $profiledata['user_points'];
$total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
$total_topics = get_db_stat('topiccount'); 
$newest_userdata = get_db_stat('newestuser'); 
$newest_user = $newest_userdata['username']; 
ImageString($im, 3, 148, 2, "**your forum name*", $tc);
ImageString($im, 1, 330, 1, "*your forum URL*", $tc); 
ImageString($im, 3, 148, 15, "$username", $tc); 
if ( $profiledata['user_level'] == 1 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Administrator", $tc); 
				}
else if ( $profiledata['user_level'] == 2 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Moderator", $tc);				}
else if ( $profiledata['user_level'] == 0 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " User", $tc);				}
ImageString($im, 2, 148, 35, "Level: $level", $tc); 
ImageString($im, 2, 148, 45, "Posts: $posts", $tc); 
ImageString($im, 2, 148, 55, "Gil: $gil", $tc);
ImageString($im, 2, 148, 65, "Post Percentage: $percentage%", $tc); 
header("Content-Type: image/png"); 
Imagepng($im,'',100); 
ImageDestroy ($im); 
}
?>
So if you put bg=1 you get signature2.png as your background bg=2 you get signature3.png as your background and if you don't put a bg variable you get signature.png as the background, also if you add a bg= variable that doesn't exist it will use the default one.

If you want to add more backgrounds then do this:

FIND

Code: Select all

else
{
BEFORE ADD

Code: Select all

else if ( $bg == *new variable* )
{
$image = "signature*number*.png"; 
$im = imagecreatefrompng($image); 
$tc  = ImageColorAllocate ($im, 255, 255, 255); 
$red  = ImageColorAllocate ($im, 255, 0, 0); 
$posts = $profiledata['user_posts'];
$username = $profiledata['username'];
$level = floor( pow( log10( $profiledata['user_posts'] ), 3 ) ) + 1; 
$points = $profiledata['user_points'];
$total_posts = get_db_stat('postcount');
$percentage = ( $total_posts ) ? min(100, ($profiledata['user_posts'] / $total_posts) * 100) : 0;
ImageString($im, 3, 148, 2, "*Your Forum Name*", $tc);
ImageString($im, 1, 330, 1, "*your forum URL*", $tc); 
ImageString($im, 3, 148, 15, "$username", $tc); 
if ( $profiledata['user_level'] == 1 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Administrator", $tc); 
				}
else if ( $profiledata['user_level'] == 2 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " Moderator", $tc);				}
else if ( $profiledata['user_level'] == 0 )
				{
ImageString($im, 2, 148, 25, "Rank:", $tc);
ImageString($im, 3, 175, 25, " User", $tc);				}
ImageString($im, 2, 148, 35, "Level: $level", $tc); 
ImageString($im, 2, 148, 45, "Posts: $posts", $tc); 
ImageString($im, 2, 148, 55, "Points: $points", $tc);
ImageString($im, 2, 148, 65, "Post Percentage: $percentage %", $tc); 
header("Content-Type: image/png"); 
Imagepng($im,'',100); 
ImageDestroy ($im); 
}
There are some bits in the code you need to change for your forum:

*new variable* to the variable it can be a number or a word as long as it's only letters and numbers.

signature*number*.png to the new image name to easily organise them you can use a number after signature or a word for example for a final fantasy style sig you could use signatureff7.png

*Your Forum Name* to the name of your forum.

*your forum URL* to the url for your forum

Points (not $points if you change the $points make sure it still has the $ an that all instances of it are the same) to the name of your forum currency (if you have one, if not delete all code reffering to points).


Also note if you are using mods which add ranks (ie super moderator, junior admin ect.) then you'll need to add code for that I can't at this momment support this mod for this instance as I do not know anything of the mods.

Here's some examples of the code in action:

https://camo.phpbb.com/1806c0664c1c2546f5559ad7ed21a5d4ad5c80c5/687474703a2f2f7777772e74686573696d73756e6974792e6e65742f466f72756d732f7369676e6174757265332e7068703f753d39
Image

http://www.thesimsunity.net/Forums/sign ... p?u=2&bg=7
Image

http://www.thesimsunity.net/Forums/sign ... ?u=10&bg=8
Image

http://www.thesimsunity.net/Forums/sign ... u=111&bg=9
Image

http://www.thesimsunity.net/Forums/sign ... ?u=2&bg=10
Image

Yeah you fear the Final Fantasy fan boy. :P

If you want any further help I'll be more then happy to provide it but only through this thread and via my forum (conact me aka The End 007 at http://www.thesimsunity.net/Forums/index.php ). I think that's about everything you need to know but if I have missed anything then drop me a line. :wink:
Space Penguin, Large as life and twice as ugly.
User avatar
beggers
Registered User
Posts: 1257
Joined: Fri Nov 23, 2001 8:19 pm
Location: Las Vegas
Contact:

Post by beggers »

Space Penguin,

Thanks for taking the time to post the code and explain in such detail. I really appreciate it! Nice work!

Bryan
Space Penguin
Registered User
Posts: 152
Joined: Mon Jul 28, 2003 6:57 am
Location: Somewhere Posts: 99999999

Post by Space Penguin »

No problem, to be honest I'd rather do an in depth explanation for everyone then have to explain it to individuals because I wasn't clearer when I first posted it. I'm also sick of people saying, if you don't know what you're doing then do do it, which I don't think is right, working on this and with existing mods helped me a lot with coding and such and someday I want to create some useful mods, code like this should be useable by everyone not just those who know how to use it, I mean sobody could probably come up with something ten times better, probably have more features, intergrate it with other mods.

In short I think that phpBB and the mods that go with it should be something anyone with a basic understanding of computers should be able to use. :D
Space Penguin, Large as life and twice as ugly.
HelpMePls
Registered User
Posts: 131
Joined: Tue Jul 01, 2003 8:23 am

Post by HelpMePls »

can i use jpg instead of png?
whoo
Registered User
Posts: 575
Joined: Fri Mar 07, 2003 4:12 am

Post by whoo »

[off topic]
sannie got caught hotlinking, tsk tsk
[/off topic]
Locked

Return to “[2.0.x] MODs in Development”