[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.
Sodacider
Registered User
Posts: 5
Joined: Sun Sep 28, 2003 5:42 am

Post by Sodacider »

Wasn't aware of sig size limit, so I had to change down to an older x60 pixel sig...
The one I'm able to help people with looks like this:

Image

Hades
Registered User
Posts: 784
Joined: Thu Jan 10, 2002 3:31 pm
Location: The Underworld
Contact:

Post by Hades »

Thanks for this MOD. Very nice :)
Hades
Lord of the Underworld


Like roleplaying? Try BlastRPG Forums

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

Post by Space Penguin »

With a little work you can get it to take use stats instead:

Image

I saw it done where you add:

Code: Select all

&bg=
to the end of the url and put a number after the = and it gets a different background, how is that done?
Space Penguin, Large as life and twice as ugly.

mm3guy
Registered User
Posts: 197
Joined: Tue Oct 14, 2003 8:13 pm

Post by mm3guy »

Could you post the code for that?

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

Post by Space Penguin »

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

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]));


$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'];
	}
}

$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; 
$gil = $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, "The Sims Unity Forum", $tc);
ImageString($im, 1, 330, 1, "http://www.thesimsunity.net", $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); 
?>
Note: you need to change the signature.png so it is 470 x 82 in size.

Also you need to change the gil and $gil to your currency name if you use the points mod. You don't need the hp/mp/exp mod to get the level though as the calculation is done within the signature.php file itself.

The only other things you need to change are the bit where it says:

"The Sims Unity Forum" to the name of you forum and "http://www.thesimsunity.net" to the url of your site.

Also you'll get errors unless you add ?u=[user id number] to the end, so it will work for every user just change the number to their user id number which can be found by looking at the extension when you view their profile.

Edit: Oh and Nyaren if I see dynamic TSC banner I will kick you so hard in the nads, well if I see a dynamic user stats banner, I made this.
Space Penguin, Large as life and twice as ugly.

mm3guy
Registered User
Posts: 197
Joined: Tue Oct 14, 2003 8:13 pm

Post by mm3guy »

You just made a completely different MOD!

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

Post by Space Penguin »

mm3guy wrote: You just made a completely different MOD!


Huh?
Space Penguin, Large as life and twice as ugly.

boyo
Registered User
Posts: 6
Joined: Sat Nov 08, 2003 1:47 pm

Post by boyo »

Question, I saw this on another forum one day and asked the guy how he did it, he gave me the code for it, which is basically identical to what's posted here. But sometimes my image doesnt load, one minute i'll get a red X the next it loads just fine. Not sure what the deal with it is. Is there a possibility that my server is to bogged down to allow it to load? (Very Slow Server)

GameBoy™
Registered User
Posts: 6
Joined: Wed Sep 03, 2003 3:25 pm

Post by GameBoy™ »

Why is my forum sig (not this 1) "blocky" as in bad quality????

mm3guy
Registered User
Posts: 197
Joined: Tue Oct 14, 2003 8:13 pm

Post by mm3guy »

Space Penguin wrote:
mm3guy wrote:You just made a completely different MOD!


Huh?

You made a cool new statistics sig!

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

Post by Space Penguin »

mm3guy wrote:
Space Penguin wrote:
mm3guy wrote:You just made a completely different MOD!


Huh?

You made a cool new statistics sig!


Yes and no, you see I wasn't the first as I said somewhere I saw this done before, I asked the guy (sleipnir) how he did it and he pointed me to this thread and said he modified it to get user stats.

So I downloaded the mod, then looked at how the viewprofile.php gets the userdata and based the modifcations on that, so I wasn't the first, and I didn't write the code, most of it was copy and paste from the viewtopic.php and it is still the signature mod it's based on I spotted some of the old code that I didn't delete ie.

Code: Select all

$total_topics = get_db_stat('topiccount'); 
$newest_userdata = get_db_stat('newestuser'); 
Space Penguin, Large as life and twice as ugly.

doublehard
Registered User
Posts: 10
Joined: Thu Oct 30, 2003 6:27 am
Location: Lincoln, UK
Contact:

Post by doublehard »

hmm has this worked

Quinn1981
Registered User
Posts: 38
Joined: Tue Nov 26, 2002 2:19 am
Location: Lyons, GA, USA
Contact:

Post by Quinn1981 »

Is there any way that the image can be cached for a time period... like say every day one is saved? That way people with weaker hosting could save on server load.

Quinn1981
Registered User
Posts: 38
Joined: Tue Nov 26, 2002 2:19 am
Location: Lyons, GA, USA
Contact:

Post by Quinn1981 »

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.

gopunkyourself
Registered User
Posts: 122
Joined: Mon Dec 01, 2003 9:41 pm
Contact:

Post by gopunkyourself »

no offense, i dont want this to come off as rude in any way...
but this mod is called dynamic signature and has already been released...your coding is almost identical too. Theres another one at smartors site too...i also believe rapid dream worked on one too.

Locked

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