TinyPortal

Development => Block Codes => Topic started by: akulion on November 04, 2006, 03:53:42 AM

Title: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 03:53:42 AM
 :2funny: 3 in 1  :2funny:

man I sound like a salesman!!

Anyways here is a "combinitation" of some excellent codes by JPdeni

Demo (http://path-to-peace.net/forum/index.php)
Just browse down until u see it  :coolsmiley:

Put this in a center block and activate

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://path-to-peace.net/forum/noava2.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';


PS: this code is supplied as is and is without any warranty - if using it makes your forum explode then there is no liability claim on aku or jpdeni

Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 03:56:23 AM
Configuration:

u can change $count = 2;
to whatever u want to display more newest members

Change this to ur own url :P
http://path-to-peace.net/forum/noava2.gif
u can use the image, found it on an avatars site :up:

You can change this
$numberofposters = 10; // You can change this to however many you want
To display more top posters

this whole part is customizable - its plain HTML so figure it out

<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td  width="150">

Thats it enjoy
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on November 04, 2006, 07:06:45 AM
Is there any way to make it not include admin ??

I have like almost 400 post and the one below me has 11  ;D

Edit: Is there anyway to make a 4th row and put this code in there ??

global $db_prefix,$modSettings;

$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Medlemmer: ', $modSettings['totalMembers'],'<br/>';
echo 'Denne mÃÆ'Ã,Â¥ned: ', $row['month'],'<br/>';
echo 'Denne uge: ', $row['week'],'<br/>';
echo 'Sidste 24 timer: ', $row['today'];


Please help me Aku, my coding skills are not very good  :) You can take a look here and see that it looks a little messy because i dont use sidebars on the oage that i want to use you center block !
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 07:23:59 AM
yes its very simple :D

just delete the admin account and VIOLA!

:2funny:

lol just kiddin - as stated its jp's codes

so this might help
http://www.tinyportal.net/smf/index.php?topic=8762.msg71821#msg71821

also look out for them around - they can make code faster than i can make chocolate chip milkshakes!
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on November 04, 2006, 07:41:00 AM
Sorry Aku but that didnt help me at all   ::)

Is there something i can simply put in to you code so it just dont show the admin in the top poster list.. and in the poster cloud ??
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on November 04, 2006, 01:14:23 PM
To eliminate admins from the list, change

SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

to

SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND ID_GROUP <> 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);


and in the poster cloud area, change


$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

to

$query = db_query(
    "SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);


As for adding the other code --

Merge the two "global" lines -- so that the first line looks like

global $db_prefix, $memberContext, $modSettings;


and, at the end, change


echo '</div></td>
</table>';


to


echo '</div></td><td>';
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Medlemmer: ', $modSettings['totalMembers'],'<br/>';
echo 'Denne mÃÆ'Ã,Â¥ned: ', $row['month'],'<br/>';
echo 'Denne uge: ', $row['week'],'<br/>';
echo 'Sidste 24 timer: ', $row['today'];

echo '</td></tr></table>';



Oh, and Aku, you need to close your table row. ;)
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on November 04, 2006, 02:17:14 PM
Thanks alot .. its very nice of you to help me out this way.. it worked almost like a charm..

only issue is that it didnt remove admin from the Top posters ??

The other things worked fine..

here is my code.. maybe you can see why it still shows my name as the number one top poster

global $db_prefix, $memberContext, $modSettings;



$count = 1;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND ID_GROUP <> 1 AND ID_GROUP <> 2 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="5" style="border-collapse: collapse">
<tr><td  bgcolor="#FFFFFF" width="10"><font color="#000000" face="Verdana" size="2"><b>Nyeste:</b></font></td><td bgcolor="#FFFFFF" width="150"><font color="#000000" face="Verdana" size="2"><b>Top 6 Aktive</b></font></td><td  bgcolor="#FFFFFF"><font color="#000000" face="Verdana" size="2"><b>Denne uges mest aktive medlemmer:</b></font></td><td  bgcolor="#FFFFFF" width="10"><font color="#000000" face="Verdana" size="2"><b>Statistik:</b></font></td></tr><tr>

<td  width="90">';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://path-to-peace.net/forum/noava2.gif" height=80 widh=80><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 6; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td  width="150" align="middle">';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);


while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 6;
  $name = str_replace(" ",'ÂÃ,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td width="150">';
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo 'Medlemmer: ', $modSettings['totalMembers'],'<br/>';
echo 'Denne mÃÆ'Ã,Â¥ned: ', $row['month'],'<br/>';
echo 'Denne uge: ', $row['week'],'<br/>';
echo 'Sidste 24 timer: ', $row['today'];

echo '</td></tr></table>';
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on November 04, 2006, 02:48:00 PM
I see. It's the middle one that's the top posters. I thought it was the first one. If you have new admins or global moderators, they won't be listed as new members. :)

The top posters comes from an SSI function, but we can copy it here to do some editing of it. (I get nervous when I edit the SSI.php file directly.)

Change
$numberofposters = 6; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td  width="150" align="middle">';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';


to


$numberofposters = 6; // You can change this to however many you want

$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
                          WHERE ID_GROUP <> 1
                          AND ID_GROUP <> 2
ORDER BY posts DESC
LIMIT $numberofposters", __FILE__, __LINE__);
$top_posters= array();
while ($row = mysql_fetch_assoc($request))
$top_posters[] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'posts' => $row['posts']
);
mysql_free_result($request);


echo'</td><td  width="150" align="middle">';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on November 04, 2006, 03:09:34 PM
Perfect ! Thanks a million  ;) If i could give you karma i would.. really thank a lot !  ;)
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on November 04, 2006, 03:18:02 PM
A million? No. Half a million will do. ;)

I'm just glad to help. We're all in this together.
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 03:59:29 PM
:D table row closed! :D

hey those are all ur codes yea?

ill make the correction :up:

***added***

here are some nice avatars for no avatar:
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpath-to-peace.net%2Fforum%2Fnoava.gif&hash=18b256714f4b33525b768313e82324e95a99c536)
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpath-to-peace.net%2Fforum%2Fnoava1.gif&hash=1760da5b41447e100c5df2a95831f439e38abbaa)
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpath-to-peace.net%2Fforum%2Fnoava2.gif&hash=19ee427c8426a8d6bff4dffc8bef15d495546e55)
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpath-to-peace.net%2Fforum%2Fnoava3.gif&hash=73b22df7aed16e9d0d7caf2cd540c5be6407d0a9)
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpath-to-peace.net%2Fforum%2Fnoava4.gif&hash=7caf3f5104125fa3df3a37076ae60d4e76d6b25f)
and one for guests
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fpath-to-peace.net%2Fforum%2Fguestava.gif&hash=b6703ea1ca4ea040a14a389b25b086c915425c47)

Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on November 04, 2006, 04:21:45 PM
Quotehey those are all ur codes yea?
Sorta. I copied the top posters function from SSI.php and just added a WHERE clause. I don't need credit for these. :)

I really like the icon that looks like the picture has been cello-taped onto the page. That's very cute.
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on November 04, 2006, 04:48:43 PM
Another cool snippet   8)
Title: Re: Top Stats - 3 in 1 Block
Post by: bluedevil on November 04, 2006, 05:14:32 PM
This is pretty cool. Well done :up:

The only problem is,the center box got wider so it made the forum blocks out of place. Not much tho' but you still have to scroll over to see intire forum.

How i can i resize it?
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 05:26:27 PM
do u have the Resizer-Function-2000 Mod installed?
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 05:29:01 PM
lol im just kidding i made that one up

all u have to do is search for width=" in the code

u will see that where it says width="150" thats the LEFT column
where it says width="200" thats the CENTEr column

just change them around to fix it up :D
u'll find 2 instances of each
Title: Re: Top Stats - 3 in 1 Block
Post by: bluedevil on November 04, 2006, 05:33:19 PM
Quote from: Aku on November 04, 2006, 05:29:01 PM
lol im just kidding i made that one up

all u have to do is search for width=" in the code

u will see that where it says width="150" thats the LEFT column
where it says width="200" thats the CENTEr column

just change them around to fix it up :D
u'll find 2 instances of each

Thnx Aku!!!! :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on November 04, 2006, 05:46:22 PM
welcome :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: metal13 on November 12, 2006, 02:04:36 AM
cool... can you add avatars on ''Who's Online''??
Forum > Who's Online


http://www.tinyportal.net/smf/index.php?topic=9916.0
Title: Re: Top Stats - 3 in 1 Block
Post by: Sin69 on November 18, 2006, 09:48:06 AM
Thanks Aku, I absolutely love this code and the Avatars too.

Thanks also to knat for turning it into a 4 in 1
and JPDeni for showing how to remove admin stats.

This post (http://www.tinyportal.net/smf/index.php?topic=8285.msg68662#msg68662) by nokonium gave me an alternative idea for the 4th column - a way to show Arcade High Scores using the Top Scores block.

Stitched it together in a phpbox, called it "Our Members" & Yay, it works! (http://detonator.com.au/forums/index.php)

Thanks Again Everyone!

Here's the...


global $db_prefix, $memberContext, $modSettings;

$count = 1;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND ID_GROUP <> 1 AND ID_GROUP <> 2 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" bordercolor="#444444" width="100%" id="table1" cellpadding="5" style="border-collapse: collapse">
<tr><td  bgcolor="#444444" width="10"><font color="#ffffff" face="Verdana" size="2"><b>Newest</b></font></td><td bgcolor="#444444" width="150"><font color="#ffffff" face="Verdana" size="2"><b>Top 6 Active</b></font></td><td  bgcolor="#444444"><font color="#ffffff" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#444444"><font color="#ffffff" face="Verdana" size="2"><b>High Scores</b></font></td></tr><tr>

<td  width="90">';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://yourwebsite.com/noava2.gif" height=80 widh=80><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 6; // You can change this to however many you want

$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
                          WHERE ID_GROUP <> 1
                          AND ID_GROUP <> 2
ORDER BY posts DESC
LIMIT $numberofposters", __FILE__, __LINE__);
$top_posters= array();
while ($row = mysql_fetch_assoc($request))
$top_posters[] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'posts' => $row['posts']
);
mysql_free_result($request);


echo'</td><td  width="150" align="left">';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);


while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 6;
  $name = str_replace(" ",'ÂÃ,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td width="150">';

//Arcade High Scores

// -- SETUP EDITS ---

$db_prefix = 'smf_'; //edit this to your your database prefix - usually smf_
$chno = 5; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players";
$txtwin = "Highest Scores :";
$txtlate = "Latest High Score by ";
$txtwit = "with ";
$txton = "on ";

global $scripturl;
require('./Settings.php');


$link = mysql_connect($db_server, $db_user, $db_passwd);
mysql_select_db($db_name, $link);

// --START BLOCK CODE --
$content = "";  //set blank for a start

//Get newest champ or die
$sql = "SELECT m.ID_MEMBER,m.realName,g.id, g.game, g.name,g.champion_score "
. "FROM {$db_prefix}members m , {$db_prefix}games g "
. "WHERE g.champion_score > 0 AND m.ID_MEMBER=g.champion_member "
. "ORDER BY g.champion_time DESC LIMIT 0,1";

if(!($result = mysql_query($sql,$link)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['id'];
$game_name = $row['name'];
$score = $row['champion_score'];

//now get the pic for the game
$ext = array('gif','GIF','png','PNG','jpg','JPG',);
$game_pic = ""; // No thumbnail for default
foreach($ext as $ex)
{
if(file_exists($boarddir. "/Games/".$row['game'].".".$ex))
{
$game_pic = $boardurl."/Games/".$row['game'].".".$ex;
}
}


//Get the 10 best players or die
$sql = "SELECT m.ID_MEMBER, m.realName, count(g.id) As cnt"
. " FROM {$db_prefix}games g, {$db_prefix}members m"
. " WHERE m.ID_MEMBER=g.champion_member"
. " GROUP BY realName "
. " ORDER BY cnt DESC LIMIT 0,{$chno}";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the best players");
}

$row = mysql_fetch_assoc($result);

$score_poss=0; //players position

//make the block content
$content .= "<table width=\"100%\">";

$content .= "
<tr>
<td>
<marquee behavior='scroll' align='center' direction='up' height='100' scrollamount='1' scrolldelay='50' onmouseover='this.stop()' onmouseout='this.start()'>
<br />
<div align=\"center\"><a href=\"{$scripturl}?action=arcade;sa=play;game={$game_id}\"><img src=\"{$game_pic}\" border= \"0\" /></a>
<br />{$txtlate}<br />
<a href=\"{$scripturl}?action=profile;u=$playerid\">{$player}</a><br />{$txtwit} {$score} {$txton} {$game_name}
<br />------------------<br />{$txtplay}
<br /><br /> ";
do
{
$score_poss++;
$content .= "
$score_poss -
<a href=\"{$scripturl}?action=profile;u=".$row['ID_MEMBER']."\"> ".$row['realName']."</a>
<br /> $txtwin ".$row['cnt']."
<br /><br />";
}  while ($row = mysql_fetch_assoc($result));

mysql_free_result($result);
$content .= "</marquee></div></td></tr></table>" ;

echo $content;

echo '</td></tr></table>';




Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on January 12, 2007, 10:22:40 PM
So strange.  I used this as a php center block and it worked.  An hour later all I see was the block title and no content   :o

This is the code I was using.  Any idea on what could be wrong?  I didn't make too many changes based on the code on the first post of this thread.

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Last 2 Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Week's Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://www.avalanchestyle.com/forum/Themes/default/images/noavatar.gif" height=50 width=50><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on January 13, 2007, 05:32:07 AM
Hahaha I figured it out!  It didn't like the apostraphe in this section of the code were I changed it to say, 'This Week's Top Posters'.  When I took out the apostraphe on the word 'Week's', the code worked     :idiot2:
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on January 13, 2007, 10:18:33 AM
lol :D
Title: Re: Top Stats - 3 in 1 Block
Post by: RvG on January 13, 2007, 03:49:46 PM
thank you thnak you thnak you... :)
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on January 13, 2007, 05:33:13 PM
Quote from: Aku on January 13, 2007, 10:18:33 AM
lol :D

Didn't think that would effect the actual display of the code   :idiot2:    :2funny:
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 14, 2007, 06:36:39 AM
how do i put this only on the frontpage like path-to-peace's frontpage where he has tons of stuff on it and they dont seem like articles?
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on January 14, 2007, 11:16:28 AM
My front page is all Blocks...
Some are PHP, some are Script blocks, but every single one is just basically a block.

My settings for the front page are:
- use only single page
- Normal, frontblocks are shown alone
- show left blocks, show center blocks
- All articles are set NOT to display on front page.

Thats about it really.
Hope it helps you out
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 14, 2007, 07:36:23 PM
where is the - All articles are set NOT to display on front page.?
Title: Re: Top Stats - 3 in 1 Block
Post by: Lesmond on January 14, 2007, 07:49:59 PM
you will find that under "Options" in  the edits for each article 

sorry it reads  "Show on front page:  No o  Yes o
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 14, 2007, 10:14:06 PM
 MeRcChRiS   6
()
Master   1
()
Daikenkaiking   0
()
Scorpio   0
()
Jo.O   0
()

ok im getting () those on the bottom of each name. Im not sure how to get them around the numbers.
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 03:25:18 AM
*bump* Please help
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on January 15, 2007, 03:35:18 AM
Can you show us the code your using so we can figure out what is causing this? ???
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 06:48:36 AM
global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://path-to-peace.net/forum/noava2.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on January 15, 2007, 12:38:32 PM
I copied your code into a block and it came out just fine. No problem at all.
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 05:24:45 PM
well just look at my front page

http://gfximpulse.blankcolors.com/forum/index.php

they () are under the names.
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on January 15, 2007, 05:43:37 PM
That is strange. I see that the only place in the code that shows () is the array. But you will have to talk to JPDeni about that pretty much.
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on January 15, 2007, 06:18:12 PM
this is just a wild shot but it may be being caused because the top 10 members are not there

meaning ur site dosent have enough members yet to fill the array...
so try reducing this:
$numberofposters = 10

to this:
$numberofposters = 5

Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 06:44:23 PM
That is a no go on that. im not sure what it is.
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on January 15, 2007, 06:47:33 PM
very weird - its working for everyone but u

I dont know if it could be server related since different servers have different settings - but I doubt thats the problem otherwise SMF functions would not work either.

JPDeni may have an answer sooner or later - shes an expert in php :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 06:48:32 PM
ha ok i see, maybe its a setting i have maybe. meh.
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on January 15, 2007, 07:15:21 PM
I don't know what the problem can be. It's not the php because it works elsewhere. The only thing I can suggest is that the problem is with tables and divs and other blocks.

Here's what I would do. I would turn off all of the blocks on the front page, so none of them show. Then turn on the 3 in 1 block and see if you still have the same problem. If you do, then it's not a problem with the other blocks. If you don't have the problem, then you need to look at one of the other blocks.
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 07:18:23 PM
is there a way to just take those off and just leave the number without any ()
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on January 15, 2007, 07:20:45 PM
Change


  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';


to


  echo $poster['link'] , ' ', $poster['posts'] , '<br />';


That way, there's just a space between the poster name and the number of posts.
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 15, 2007, 07:23:45 PM
hmm i guess that would work
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on January 16, 2007, 01:30:06 PM
well did it?
Title: Re: Top Stats - 3 in 1 Block
Post by: MeRcChRiS on January 16, 2007, 10:58:05 PM
yes it did, not () but it doesnt matter
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on January 30, 2007, 03:16:08 AM
Can someone take this code:

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';

and add a 4th table that has the code:

echo'<center><form action="http://www.mapquest.com/maps/map.adp" method="get">
<table cellpadding="3" cellspacing="0" border="0" style="font: 11px Arial,Helvetica;">
<tr><td colspan="2">Address/Intersection:</td></tr>
<tr><td colspan="2"><input type="text" name="address" size="20" maxlength="80"></td></tr>
<tr><td colspan="2">City:</td></tr>
<tr><td colspan="2"><input type="text" name="city" size="20" maxlength="80"></td></tr>
<tr><td>State:</td><td>ZIP Code:</td></tr>
<tr><td><input type="text" name="state" size="3" maxlength="2"></td><td><input type="text" name="zipcode" size="10" maxlength="12"></td></tr>
<tr><td colspan="2" style="text-align: center;"><input type="submit" value="Get Map"><input type="hidden" name="CID" value="lfmapwid"></td></tr>
</table>
</form></center>';


Thanks much :D
Brianjw
Title: Re: Top Stats - 3 in 1 Block
Post by: akulion on January 30, 2007, 06:29:02 AM
near the end where it says

</td></tr>
</table>';

change it to:

</td><td>';
YOUR CODE GOES IN HERE
echo'</td></tr>
</table>';
Title: Re: Top Stats - 3 in 1 Block
Post by: bluedevil on January 31, 2007, 12:08:34 AM
I used the 4th row by KNAT.   This is looking even better.  (No Admin.)

Thanks AKU,KNAT and JPDeni.  You guys rock.



http://www.midwestavalancheclub.com/index.php?board=5.0

It took me a minute to modify and put things together from all those codes hehehehe....
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on January 31, 2007, 12:25:38 AM
Quote from: bluedevil on January 31, 2007, 12:08:34 AM
I used the 4th row by KNAT.   This is looking even better.  (No Admin.)

Thanks AKU,KNAT and JPDeni.  You guys rock.



http://www.midwestavalancheclub.com/index.php?board=5.0

It took me a minute to modify and put things together from all those codes hehehehe....

Lookin good Mick!   :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: bluedevil on January 31, 2007, 12:31:49 AM
Thanx Ro!


One question tho'

Does this code takes BBC codes as well?  I mean, where it says: "This weeks top posters" i would like to add a marquee?  Maybe like this?

[move]This weeks top posters[/move]

Will that work in the coding?
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on January 31, 2007, 12:34:02 AM
Quote from: bluedevil on January 31, 2007, 12:31:49 AM
Thanx Ro!


One question tho'

Does this code takes BBC codes as well?  I mean, where it says: "This weeks top posters" i would like to add a marquee?  Maybe like this?

[move]This weeks top posters[/move]

Will that work in the coding?

Not sure if it will.  It didn't like the apostrophe I put in there when I had it say, 'This week's top posters'.   I had to make it read 'This weeks top posters'   :uglystupid2:
Title: Re: Top Stats - 3 in 1 Block
Post by: oliver on February 01, 2007, 03:01:18 AM
On This Weeks Top Posters it shows usernames and not display names so if somone change is name it will show the name that he or she use to log in.

Can this be changed ?

Thank you  :coolsmiley:
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on February 01, 2007, 03:14:09 AM
Quote from: oliver on February 01, 2007, 03:01:18 AM
On This Weeks Top Posters it shows usernames and not display names so if somone change is name it will show the name that he or she use to log in.

Can this be changed ?

Thank you  :coolsmiley:
Yes, I need one that can do this too except with the code added as specified before. :D
Title: Re: Top Stats - 3 in 1 Block
Post by: oliver on February 01, 2007, 03:47:02 AM
I don't know anything about coding so i guess I have to wait to. Well is nice I like this mode anyway.  :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on February 01, 2007, 05:23:38 AM
I haven't been feeling well, so I haven't been able to answer questions. But things have been piling up in this topic, so I figure I'd better try to answer some things.

No, you can't use bbc code with this. However, you can html code. You should be able to use


<marquee>This week\'s top posters</marquee>


Brian, did you try the code that Aku gave you?

As for the username, you can change function ssi_topPoster in SSI.php. Change every instance of realName to memberName. I think. I get confused with which one of those is which. :)

Is that everything?
Title: Re: Top Stats - 3 in 1 Block
Post by: oliver on February 01, 2007, 05:50:51 AM
I'm sorry JPDeni, I don't know any thing about coding but I want to include one personal opinion.

The code for the top 10 posters is displaying the users with the display name no matter what is that, and the top posters this week is showing with the userrname that they first register on the forum. Basically you can see some top 10 posters that are same with some top week posters but with completely different name. I thought it will be nice to be same that's all.

Thanks once again  :coolsmiley:
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on February 01, 2007, 05:55:33 PM
Quote from: brianjw on January 30, 2007, 03:16:08 AM
Can someone take this code:

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';

and add a 4th table that has the code:

echo'<center><form action="http://www.mapquest.com/maps/map.adp" method="get">
<table cellpadding="3" cellspacing="0" border="0" style="font: 11px Arial,Helvetica;">
<tr><td colspan="2">Address/Intersection:</td></tr>
<tr><td colspan="2"><input type="text" name="address" size="20" maxlength="80"></td></tr>
<tr><td colspan="2">City:</td></tr>
<tr><td colspan="2"><input type="text" name="city" size="20" maxlength="80"></td></tr>
<tr><td>State:</td><td>ZIP Code:</td></tr>
<tr><td><input type="text" name="state" size="3" maxlength="2"></td><td><input type="text" name="zipcode" size="10" maxlength="12"></td></tr>
<tr><td colspan="2" style="text-align: center;"><input type="submit" value="Get Map"><input type="hidden" name="CID" value="lfmapwid"></td></tr>
</table>
</form></center>';


Thanks much :D
Brianjw

?
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on February 01, 2007, 08:43:46 PM
Quote from: oliver
The code for the top 10 posters is displaying the users with the display name no matter what is that, and the top posters this week is showing with the userrname that they first register on the forum. Basically you can see some top 10 posters that are same with some top week posters but with completely different name.
I don't know what that means.

Brian, yes, I know. You posted that before. Aku responded, telling you how to fix it. Did you try the code that Aku posted for you?
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on February 01, 2007, 10:08:22 PM
Quote from: Aku on January 30, 2007, 06:29:02 AM
near the end where it says

</td></tr>
</table>';

change it to:

</td><td>';
YOUR CODE GOES IN HERE
echo'</td></tr>
</table>';
Oh sorry JPDeni, lol :2funny:

My eyes were blind :o
Title: Introducing the 4 in 1 Block!
Post by: brianjw on February 01, 2007, 10:14:06 PM
Introducing the 4 in 1 block!!! YAY! edited code by Aku and JPDeni and transformed with 4 columns and the 4th column has this months birthdays! My first php customizing!! WOOHOO!

Code (If you want to use it - feel free) Select

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#00CC33"><font color="#FFFFFF" face="Verdana" size="2"><b>This Months Birthdays</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td>';
global $db_prefix, $scripturl;

echo '
  <div style="padding: 4px; font-weight: bold;">';
echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month = date('m');
      $month_number = '-' . $month . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    $birthdays = array();
    $member = array();
    while ($row = mysql_fetch_assoc($query))
    {
       $day = substr($row['birthdate'],8,2);
       $birthdays[$row['memberName']] =  $day;
       $member[$row['memberName']] = $row['ID_MEMBER'];
    }
    asort($birthdays);
    foreach ($birthdays as $key => $value)
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a> (' . $value . '.' . $month . ')<br />';
   }
}
else
  echo 'No birthdays this month';
echo'</div> ';
echo'</td></tr>
</table>';

put that code in a phpblock (CENTER BLOCK)
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on February 02, 2007, 06:04:37 AM
Nice work Brian  ;) I also changed mine to a 4 in 1 block but my 4th block shows some forum stats  8)
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on February 03, 2007, 02:02:50 AM
I was thinking about making it with tabs but couldn't understand it so I moved to the stats like you.
I have 20 top posters and I have 3 newest members...

global $db_prefix, $memberContext;

$count = 3;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><tdÃ,  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 20 Posters</b></font></td><tdÃ,  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><tdÃ,  bgcolor="#00CC33"><font color="#FFFFFF" face="Verdana" size="2"><b>Stats</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 20; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
Ã,  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
Ã,  Ã,  "SELECT posterName
Ã,  Ã,   FROM {$db_prefix}messages
Ã,  Ã,   ORDER BY posterTime DESC
Ã,  Ã,   LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
Ã,  if (!isset($count[$row['posterName']]))
Ã,  Ã,  $count[$row['posterName']] = 0;
Ã,  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
Ã,  $fsize = $count[$value] + 7;
Ã,  $name = str_replace(" ",'Ã,·',$value);
Ã,  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td>';
TPortal_statsbox();
echo'</td></tr>
</table>';

Does anyone have any idea on how to make the stats table wider? Click here to see (http://www.brianjwilson.com)

brianjw
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on February 03, 2007, 10:26:52 AM
you can control the width of each td in your table..

here is my code.. but its unuseable to you because i use some css that you dont have.. but you can maybe see how i changed my code  :)

global $db_prefix, $memberContext, $modSettings;
$count = 1;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND ID_GROUP <> 1 AND ID_GROUP <> 2 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table width="100%" id="table1">
<tr><td class="tborder6"><font color="#000000" face="Verdana" size="2"><b><center>Nyeste:</center></b></font></td><td class="tborder6" width="150"><font color="#000000" face="Verdana" size="2"><b><center>Top 5 Aktive</center></b></font></td><td class="tborder5"><font color="#000000" face="Verdana" size="2"><b><center>Sidste 7 dages mest aktive medlemmer:</center></b></font></td><td class="tborder4" align="center" width="10"><font color="#000000" face="Verdana" size="2"><b><center>Statistik:</center></b></font></td></tr><tr overflow="hidden">

<td class="tborder6" overflow="hidden" align="center" valign="middle" width="80" height="80">';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center" height="80" Width="80" overflow="auto">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://gapeindex.dk/avatars/noava.gif" height=80 width=80><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 5; // You can change this to however many you want

$request = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
                          WHERE ID_GROUP <> 1
                          AND ID_GROUP <> 2
ORDER BY posts DESC
LIMIT $numberofposters", __FILE__, __LINE__);
$top_posters= array();
while ($row = mysql_fetch_assoc($request))
$top_posters[] = array(
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'posts' => $row['posts']
);
mysql_free_result($request);


echo'</td><td class="tborder6" padding="2" width="150" align="middle" valign="middle"><center>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td></center><td class="tborder5" overflow="hidden">';

global $db_prefix, $scripturl;
$nbsp = "&n"."bsp;";
$count= array();
$poster_number = array();
$query = db_query(
    "SELECT mes.posterName, mes.ID_MEMBER, mem.ID_GROUP, grp.onlineColor
     FROM smf_messages as mes
     LEFT JOIN smf_members as mem
     ON mem.ID_MEMBER = mes.ID_MEMBER
     LEFT JOIN smf_membergroups as grp
     ON grp.ID_GROUP = mem.ID_GROUP
     WHERE mem.ID_GROUP <> 1 AND mem.ID_GROUP <> 2
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
    $poster_number[$row['posterName']] = $row['ID_MEMBER'];
    $poster_color[$row['posterName']] = $row['onlineColor'];
}

asort($count);
$low_count = reset($count);

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = intval($count[$value]/$low_count) + 4;
  if ($fsize > 18)
    $fsize = 18;
  elseif ($fsize < 8)
    $fsize = 8;
  $name = str_replace(" ",$nbsp,$value);
  if (!empty($poster_color[$value]))
    echo '<a class="link" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
    '" style="font-size:' . $fsize . 'pt; color:' . $poster_color[$value] . '"> ' . $name . ' </a> ';
  else
    echo '<a class="link" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] .
    '" style="font-size:' . $fsize . 'pt; color:' . $poster_color[$value] . '"> ' . $name . ' </a> ';
}
echo '</div></td><td width="150" class="tborder4" valign="middle">';
$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');

$query = db_query("SELECT
COUNT(dateRegistered > $thisyear OR NULL) as year,
COUNT(dateRegistered > $thismonth OR NULL) as month,
COUNT(dateRegistered > $thisweek OR NULL) as week,
COUNT(dateRegistered > $today OR NULL) as today
FROM {$db_prefix}members
WHERE is_activated = 1", __FILE__, __LINE__);
$row = mysql_fetch_assoc($query);

settype($row['today'], "integer");
settype($row['week'], "integer");
settype($row['month'], "integer");

echo '<center>Medlemmer: ', $modSettings['totalMembers'],'<br/>';
echo 'Denne måned: ', $row['month'],'<br/>';
echo 'Denne uge: ', $row['week'],'<br/>';
echo 'Sidste 24 timer: ', $row['today'];

echo '</center></td></tr></table>';
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on February 28, 2007, 03:46:03 AM
How would I make: This Weeks Top Posters show up with Display Names and not usernames? ???

Code I am using:

global $db_prefix, $memberContext;

$count = 3;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 20 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#00CC33"><font color="#FFFFFF" face="Verdana" size="2"><b>Stats</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 20; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td>';
TPortal_statsbox();
echo'</td></tr>
</table>';

I think I have to modify the SSI.php but to make sure I am asking here and also am asking where. :)

Thanks,
Brianjw
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on February 28, 2007, 04:13:12 PM
Rather than modifying SSI.php, it would be better just to put the code in your block.

Instead of


$numberofposters = 20; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}



use


global $scripturl;
echo'</td><td>';
$numberofposters = 20; // You can change this to however many you want

$request = db_query("
  SELECT ID_MEMBER, memberName, posts
  FROM {$db_prefix}members
  ORDER BY posts DESC
  LIMIT $numberofposters", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
  echo '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['memberName'] . '</a>' , ' (', $row['posts'] , ')<br />';
mysql_free_result($request);


It's only a little more code, but it makes it easier to alter if you decide you want to later on.
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on February 28, 2007, 05:46:02 PM
Quote from: JPDeni on February 28, 2007, 04:13:12 PM
Rather than modifying SSI.php, it would be better just to put the code in your block.


global $scripturl;
echo'</td><td>';
$numberofposters = 20; // You can change this to however many you want

$request = db_query("
  SELECT ID_MEMBER, memberName, posts
  FROM {$db_prefix}members
  ORDER BY posts DESC
  LIMIT $numberofposters", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
  echo '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['memberName'] . '</a>' , ' (', $row['posts'] , ')<br />';
mysql_free_result($request);


It's only a little more code, but it makes it easier to alter if you decide you want to later on.

Seems to work for me, thank you!
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on February 28, 2007, 05:54:40 PM
Frases like "This weeks top posters" and "new members this month" are actually wrong

It is more like "Last 7 days top posters" and "New members in the last 30 days"

Am i right ?
Title: Re: Top Stats - 3 in 1 Block
Post by: RoarinRow on February 28, 2007, 05:58:40 PM
Quote from: knat on February 28, 2007, 05:54:40 PM
Frases like "This weeks top posters" and "new members this month" are actually wrong

It is more like "Last 7 days top posters" and "New members in the last 30 days"

Am i right ?

Not sure, but I configured mine just to show the last two members, the top 10 posters and active members this week.
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on February 28, 2007, 06:02:34 PM
You mean with this:


$today = strtotime("24 hours ago");
date('j') == 1 ? $thismonth = $today : $thismonth = strtotime(date('F') . ' 1');
date('l') == 'Sunday' ? $thisweek = $today : $thisweek = strtotime('last Sunday');
date('M') == 'January' ? $thisyear = $thismonth : $thisyear = strtotime('January 1');


No. $thismonth is defined as the first day of the current month. $thisweek is defined as the most recent Sunday. $thisyear is defined as the first day of January. The "last day" one is within the past 24 hours, though, and not since midnight on the current day.

It really would be easier to have this discussion in the orginal topic where that code was posted, though.
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on February 28, 2007, 06:07:36 PM
ohh sorry i did not know that there was other topic for this..  ??? so i post again  ^-^

But if the top poster of the week (poster cloud thing) shows from this week only would it not be empty on a monday morning then ??

The reason i am asking is that i use the code myself and i changed it to Top Posters of the Last 7 days  :)
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on February 28, 2007, 06:14:49 PM
If you want to talk about the Poster Cloud, please post in the Poster Cloud topic (http://www.tinyportal.net/index.php?topic=6996.0). The original code in the Poster Cloud looks for the past 100 posts. There is no time frame involved.

The code you borrowed dealing with time frames is from the New members Block (http://www.tinyportal.net/index.php?topic=9490.0).

QuoteThe reason i am asking is that i use the code myself and i changed it to Top Posters of the Last 7 days
If you used the code I wrote, then your title is incorrect.
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on March 01, 2007, 12:11:14 AM
JPDeni, that code did nothing different. This is the code I am using.
global $db_prefix, $memberContext;

$count = 3;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 20 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#00CC33"><font color="#FFFFFF" face="Verdana" size="2"><b>Stats</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

global $scripturl;
echo'</td><td>';
$numberofposters = 20; // You can change this to however many you want

$request = db_query("
  SELECT ID_MEMBER, memberName, posts
  FROM {$db_prefix}members
  ORDER BY posts DESC
  LIMIT $numberofposters", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
  echo '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['memberName'] . '</a>' , ' (', $row['posts'] , ')<br />';
mysql_free_result($request);

echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td>';
TPortal_statsbox();
echo'</td></tr>
</table>';


Brianjw
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on March 01, 2007, 01:22:38 AM
You wanted to change the name that was used on the top posters, yes? There are two fields in the "member" table that hold the member name -- realName and memberName. I can never tell which one is which, but I know that the SSI.php file uses the realName field, so if you wanted something different, it would have to be the memberName field.

Maybe someone else has an idea of how to do what you want to do.
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on March 01, 2007, 01:34:57 AM
Yes maybe. I was thinking maybe I coppied your code wrong or something :P lol
Anyone have some ideas. Code posted above.

http://www.brianjwilson.com veiw seen here
Title: Re: Top Stats - 3 in 1 Block
Post by: wilsy on April 07, 2007, 01:48:39 AM
Hi Aku,

Are there any copyright issues with the images in this post?

http://www.tinyportal.net/index.php?topic=10278.msg85217#msg85217

Regards,

Wilsy.
Title: Re: Top Stats - 3 in 1 Block
Post by: Shadow on April 07, 2007, 05:20:25 AM
Do you have other avatars for no avatar?
Title: Re: Top Stats - 3 in 1 Block
Post by: knat on April 07, 2007, 10:44:24 AM
i use this one... and now i come to think about it that avatar will look cool on that new scribbles theme  :D

Anyway feel free to use it  ;)
Title: Re: Top Stats - 3 in 1 Block
Post by: Shadow on April 07, 2007, 06:36:40 PM
Yea, But I mean anymore beside he posted on this topic.  I am trying to found one to match the blood-n-roses theme I am using.....
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on April 10, 2007, 12:48:27 AM
Shadow Queen, you could always make one in Photoshop if you have it ;) If you want, I can even make one for you just pm me.
Title: Re: Top Stats - 3 in 1 Block
Post by: Shadow on April 10, 2007, 01:40:17 AM
Alright, Thank's, I am going to pm you right now.
Title: Re: Top Stats - 3 in 1 Block
Post by: brianjw on April 10, 2007, 01:44:15 AM
Ok, just give me the details. I may or may not get to it tonight and I have found some nice fonts I can use for it too ive been downloading...details.details ;)
Title: Re: Top Stats - 3 in 1 Block
Post by: Shadow on April 10, 2007, 01:45:42 AM
Alright, I will, I just send you a pm and thinking what type I wanted.  Thanks alot
Title: Re: Top Stats - 3 in 1 Block
Post by: shanhi on April 13, 2007, 12:01:47 AM
Quote from: Gobo on November 04, 2006, 03:53:42 AM

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://path-to-peace.net/forum/noava2.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';


I don't want to put the avatar of the new member here please show me how I can take it off?
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on April 13, 2007, 12:06:47 AM
Delete


'.$memberContext[$user_id]['avatar']['image'].'<BR>


Be careful when you're deleting to be sure you have the quotes right.
Title: Re: Top Stats - 3 in 1 Block
Post by: confuzed on June 12, 2007, 02:07:25 PM
hello

I would like to replace the poster cloud column with the top poster of the week column as shown in the first post of this thread http://www.tinyportal.net/index.php?topic=8762.0

can someone please tell me what I need to change/remove/add for this to work?

thanks
Title: Re: Top Stats - 3 in 1 Block
Post by: confuzed on June 16, 2007, 12:50:15 PM
hi

I would like to put this code


//-------START-------------
/*
|----------------------------------
SMF ARCADE SCROLLING CHAMPS BLOCK for SMFARCADE V2
by Eric Lawson
|----------------------------------
Made for TinyPortal and SMF forum

*/
//Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder

// -- SETUP EDITS ---

$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
$row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

?>

<script type="text/javascript">

/***********************************************
* Cross browser Marquee II- Ã,© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scrollx=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeedx=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseitx=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=''

function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarqueex()",30)', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>
<?php
echo '<table width="100%">
<tr>
<td align="center">
<br />
<a href="'
,$scripturl,'?action=arcade"><img src="',$settings['images_url'],'/arcade_block.gif" border= "0" alt="Arcade" /></a>
<br /><br/>
</td>
</tr>
</table>
<div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
<div id="vmarqueex" style="position: absolute; width: 98%;">
<div align="center">
<a href="'
,$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
<br />'
,$txtlate,'<br />
<a href="'
,$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
<br/>'
,$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
<br />------------------<br />'
,$txtplay,'<br /><br />';
foreach ($bp as $out)
{
$score_poss++;
echo '',$score_poss,' - ',$out['link'],'<br />',$txtwin,' ',$out['champions'],'
     <br /><br />'
;
};
echo '</div>
</div>
</div>'
;

//---------END--------------


in a column in this multicolumn block.  The code is for the new version of arcade (2.0+)  I have to use this as the other scrolling arcade block code wont work or this arcade version.

It is scrolling champ block.

If I put it in a side block by itself it scrolls perfectly but I can't get it to work ie scroll if  I try to add it to this 3 or 4 in 1 block. 

Can someone please tell me what I need to change in the above code to get it to scroll when it is in the 3 in 1 or 4 in 1 block?  There must be something I have to remove or change but I don't know what it is.  I've been trying for hours now and I can't do it :(


thanks
Title: Re: Top Stats - 3 in 1 Block
Post by: confuzed on June 18, 2007, 09:52:55 AM
can anyone help me with this?  TY
Title: Re: Top Stats - 3 in 1 Block
Post by: IchBin on June 18, 2007, 08:26:26 PM
Try this code and see if it works. Let me know the error you get if you get one.
//-------START-------------
/*
|----------------------------------
SMF ARCADE SCROLLING CHAMPS BLOCK for SMFARCADE V2
by Eric Lawson
|----------------------------------
Made for TinyPortal and SMF forum

*/
//Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder

// -- SETUP EDITS ---

$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
$row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

echo '
<script type="text/javascript">';

/***********************************************
* Cross browser Marquee II- Ã,© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
//Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
//Specify marquee scroll speed (larger is faster 1-10)
//Pause marquee onMousever (0=no. 1=yes)?
echo '
var delayb4scrollx=2000
var marqueespeedx=1
var pauseitx=1';

////NO NEED TO EDIT BELOW THIS LINE////////////
echo '
var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=\'\'';
echo '
function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarqueex()",30)\', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>';

echo '<table width="100%">
<tr>
<td align="center">
<br />
<a href="',$scripturl,'?action=arcade"><img src="',$settings['images_url'],'/arcade_block.gif" border= "0" alt="Arcade" /></a>
<br /><br/>
</td>
</tr>
</table>
<div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
<div id="vmarqueex" style="position: absolute; width: 98%;">
<div align="center">
<a href="',$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
<br />',$txtlate,'<br />
<a href="',$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
<br/>',$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
<br />------------------<br />',$txtplay,'<br /><br />';
foreach ($bp as $out)
{
$score_poss++;
echo '',$score_poss,' - ',$out['link'],'<br />',$txtwin,' ',$out['champions'],'
     <br /><br />';
};
echo '</div>
</div>
</div>';

//---------END--------------
Title: Re: Top Stats - 3 in 1 Block
Post by: confuzed on June 18, 2007, 09:07:22 PM
Yay!  that's it, excellent.  Thank you so much :)
Title: Re: Top Stats - 3 in 1 Block
Post by: IchBin on June 18, 2007, 09:08:13 PM
hehe, never would have thought I would have got that right the first time. :)
Title: Re: Top Stats - 3 in 1 Block
Post by: confuzed on June 18, 2007, 09:15:16 PM
ah, well except for this in the error log:


8: Undefined variable: title
File: /home/*****/public_html/forum/Themes/default/TPortalBlocks.template.php(35) : eval()'d code
Line: 80


:(

here is the entire stats block code I have :


global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="100"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#00CC33" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>This Months Birthdays</b></font></td><td bgcolor="#660066" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Top Gamers</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://mysite
.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
    "SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['realName']]))
    $count[$row['realName']] = 0;
  ++$count[$row['realName']];
    $poster_number[$row['realName']] = $row['ID_MEMBER'];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  if ($fsize > 13)
    $fsize = 13;
  elseif ($fsize < 7)
    $fsize = 7;
    $name = str_replace(" ",'Ã,·',$value);
  echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
          <span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}

echo '</div></td><td>';
global $db_prefix, $scripturl;

echo '
  <div style="padding: 4px; font-weight: bold;">';
echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month = date('m');
      $month_number = '-' . $month . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    $birthdays = array();
    $member = array();
    while ($row = mysql_fetch_assoc($query))
    {
       $day = substr($row['birthdate'],8,2);
       $birthdays[$row['memberName']] =  $day;
       $member[$row['memberName']] = $row['ID_MEMBER'];
    }
    asort($birthdays);
    foreach ($birthdays as $key => $value)
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a> (' . $value . '.' . $month . ')<br />';
   }
}
else
  echo 'No birthdays this month';

echo'</td><td>';

//-------START-------------
/*
|----------------------------------
SMF ARCADE SCROLLING CHAMPS BLOCK for SMFARCADE V2
by Eric Lawson
|----------------------------------
Made for TinyPortal and SMF forum

*/
//Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder

// -- SETUP EDITS ---

$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
$row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

echo '
<script type="text/javascript">';

/***********************************************
* Cross browser Marquee II- Ã,© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
//Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
//Specify marquee scroll speed (larger is faster 1-10)
//Pause marquee onMousever (0=no. 1=yes)?
echo '
var delayb4scrollx=2000
var marqueespeedx=1
var pauseitx=1';

////NO NEED TO EDIT BELOW THIS LINE////////////
echo '
var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=\'\'';
echo '
function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarqueex()",30)\', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>';

echo '<table width="100%">
<tr>
<td align="center">
<br />
<a href="',$scripturl,'?action=arcade"><img src="',$settings['images_url'],'/arcade_block.gif" border= "0" alt="Arcade" /></a>
<br /><br/>
</td>
</tr>
</table>
<div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
<div id="vmarqueex" style="position: absolute; width: 98%;">
<div align="center">
<a href="',$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
<br />',$txtlate,'<br />
<a href="',$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
<br/>',$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
<br />------------------<br />',$txtplay,'<br /><br />';
foreach ($bp as $out)
{
$score_poss++;
echo '',$score_poss,' - ',$out['link'],'<br />',$txtwin,' ',$out['champions'],'
     <br /><br />';
};
echo '</div>
</div>
</div>';

//---------END--------------

echo'</td></tr>
</table>';



I get that everytime I look at the page that has that block on it :(  any ideas?
Title: Re: Top Stats - 3 in 1 Block
Post by: IchBin on June 18, 2007, 09:39:53 PM
Yes, the code at this line:
echo $title;
$title is not defined.

If you're not missing anything on your block, then just comment out that line and see if everything is ok.
// echo $title;
Title: Re: Top Stats - 3 in 1 Block
Post by: confuzed on June 18, 2007, 09:58:17 PM
thanks for that, it seems to have done the trick now. No errors :)  TY
Title: Re: Top Stats - 3 in 1 Block
Post by: shaka on July 03, 2007, 01:07:45 AM
fantastic code  many thanks  :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: alhaudhie on July 05, 2007, 06:36:04 PM
Quote from: Gobo on November 04, 2006, 03:53:42 AM
:2funny: 3 in 1  :2funny:

man I sound like a salesman!!

Anyways here is a "combinitation" of some excellent codes by JPdeni

Demo (http://path-to-peace.net/forum/index.php)
Just browse down until u see it  :coolsmiley:

Put this in a center block and activate

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://path-to-peace.net/forum/noava2.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td></tr>
</table>';


PS: this code is supplied as is and is without any warranty - if using it makes your forum explode then there is no liability claim on aku or jpdeni




How can i put custom background for each table..?
Title: Re: Top Stats - 3 in 1 Block
Post by: wilsy on July 28, 2007, 11:25:20 AM
Hi all,

I have this code: -

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="100"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>This Weeks Top Posters</b></font></td><td  bgcolor="#00CC33" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>This Months Birthdays</b></font></td><td bgcolor="#660066" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Top Gamers</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://www.rewindlancs.com/forum/images/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
    "SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['realName']]))
    $count[$row['realName']] = 0;
  ++$count[$row['realName']];
    $poster_number[$row['realName']] = $row['ID_MEMBER'];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  if ($fsize > 13)
    $fsize = 13;
  elseif ($fsize < 7)
    $fsize = 7;
    $name = str_replace(" ",'Ã,·',$value);
  echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
          <span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}

echo '</div></td><td>';
global $db_prefix, $scripturl;

echo '
  <div style="padding: 4px; font-weight: bold;">';
// echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month = date('m');
      $month_number = '-' . $month . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    $birthdays = array();
    $member = array();
    while ($row = mysql_fetch_assoc($query))
    {
       $day = substr($row['birthdate'],8,2);
       $birthdays[$row['memberName']] =  $day;
       $member[$row['memberName']] = $row['ID_MEMBER'];
    }
    asort($birthdays);
    foreach ($birthdays as $key => $value)
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a> (' . $value . '.' . $month . ')<br />';
   }
}
else
  echo 'No birthdays this month';

echo'</td><td>';

//-------START-------------
/*
|----------------------------------
SMF ARCADE SCROLLING CHAMPS BLOCK for SMFARCADE V2
by Eric Lawson
|----------------------------------
Made for TinyPortal and SMF forum

*/
//Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder

// -- SETUP EDITS ---

$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
$row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

echo '
<script type="text/javascript">';

/***********************************************
* Cross browser Marquee II- Ã,© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
//Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
//Specify marquee scroll speed (larger is faster 1-10)
//Pause marquee onMousever (0=no. 1=yes)?
echo '
var delayb4scrollx=2000
var marqueespeedx=1
var pauseitx=1';

////NO NEED TO EDIT BELOW THIS LINE////////////
echo '
var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=\'\'';
echo '
function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarqueex()",30)\', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>';

echo '<table width="100%">
<tr>
<td align="center">

</td>
</tr>
</table>
<div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
<div id="vmarqueex" style="position: absolute; width: 98%;">
<div align="center">
<a href="',$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
<br />',$txtlate,'<br />
<a href="',$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
<br/>',$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
<br />------------------<br />',$txtplay,'<br /><br />';
foreach ($bp as $out)
{
$score_poss++;
echo '',$score_poss,' - ',$out['link'],'<br />',$txtwin,' ',$out['champions'],'
     <br /><br />';
};
echo '</div>
</div>
</div>';

//---------END--------------

echo'</td></tr>
</table>';


.....and want to replace the 'Birthday' column with all of the TP stats block info (Members, Stats and Users Online). Can anybody help?

Regards,

Wilsy.
Title: Re: Top Stats - 3 in 1 Block
Post by: SoulPleX on July 30, 2007, 10:45:14 PM
how can i have the members group colors show up for any of these blocks?
Title: Re: Top Stats - 3 in 1 Block
Post by: wilsy on August 02, 2007, 09:31:57 AM
QuoteHi all,

I have this code: -

Code:

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
   SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
   $users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
   <tr><td  bgcolor="#FF9900" width="100"><font color="#FFFFFF" face="Verdana" size="2">Newest Members</font></td><td bgcolor="#660066" width="150"><font color="#FFFFFF" face="Verdana" size="2">Top 10 Posters</font></td><td  bgcolor="#336699" width="150"><font color="#FFFFFF" face="Verdana" size="2">This Weeks Top Posters</font></td><td  bgcolor="#00CC33" width="150"><font color="#FFFFFF" face="Verdana" size="2">This Months Birthdays</font></td><td bgcolor="#660066" width="150"><font color="#FFFFFF" face="Verdana" size="2">Top Gamers</font></td></tr><tr>
      <td>';
$i = 0;
foreach($users as $user_id) {
   if ($i > 0) echo '
';
   $i++;

   loadMemberContext($user_id);

   if (!empty($memberContext[$user_id]['avatar']['image']))
      echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
   else
      echo '<div align="center"><img src="http://www.rewindlancs.com/forum/images/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 10; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')
';
}
echo'</td><td>';

global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
    "SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['realName']]))
    $count[$row['realName']] = 0;
  ++$count[$row['realName']];
    $poster_number[$row['realName']] = $row['ID_MEMBER'];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  if ($fsize > 13)
    $fsize = 13;
  elseif ($fsize < 7)
    $fsize = 7;
    $name = str_replace(" ",'Ã,·',$value);
  echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . '">
          <span style="font-size:' . $fsize . 'pt;">' . $name . '</span></a> ';
}

echo '</div></td><td>';
global $db_prefix, $scripturl;

echo '
  <div style="padding: 4px; font-weight: bold;">';
// echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month = date('m');
      $month_number = '-' . $month . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    $birthdays = array();
    $member = array();
    while ($row = mysql_fetch_assoc($query))
    {
       $day = substr($row['birthdate'],8,2);
       $birthdays[$row['memberName']] =  $day;
       $member[$row['memberName']] = $row['ID_MEMBER'];
    }
    asort($birthdays);
    foreach ($birthdays as $key => $value)
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a> (' . $value . '.' . $month . ')
';
   }
}
else
  echo 'No birthdays this month';

echo'</td><td>';

//-------START-------------
/*
|----------------------------------
SMF ARCADE SCROLLING CHAMPS BLOCK for SMFARCADE V2
by Eric Lawson
|----------------------------------
Made for TinyPortal and SMF forum

*/
//Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder

// -- SETUP EDITS ---

$no = 10; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
   die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
   $row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

echo '
<script type="text/javascript">';

/***********************************************
* Cross browser Marquee II- Ã,© Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
//Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
//Specify marquee scroll speed (larger is faster 1-10)
//Pause marquee onMousever (0=no. 1=yes)?
echo '
var delayb4scrollx=2000
var marqueespeedx=1
var pauseitx=1';

////NO NEED TO EDIT BELOW THIS LINE////////////
echo '
var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=\'\'';
echo '
function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarqueex()",30)\', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>';

echo '<table width="100%">
         <tr>
            <td align="center">
            
            </td>
         </tr>
      </table>
      <div id="marqueecontainerx" style="position: relative; width: 95%; height:200px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
         <div id="vmarqueex" style="position: absolute; width: 98%;">
            <div align="center">
               <a href="',$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
               
',$txtlate,'

               <a href="',$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
               
',$txtwit,' ',$score,' ',$txton,'
',$game_name,'
               
------------------
',$txtplay,'

';
               foreach ($bp as $out)
               {
                  $score_poss++;
                  echo '',$score_poss,' - ',$out['link'],'
',$txtwin,' ',$out['champions'],'
                       

';
               };
   echo '</div>
         </div>
      </div>';
      
//---------END--------------

echo'</td></tr>
</table>';


.....and want to replace the 'Birthday' column with all of the TP stats block info (Members, Stats and Users Online). Can anybody help?

Regards,

Wilsy.

Anybody at all? I would settle for users online in a scrollbox ;)

Regards,

Wilsy.
Title: Re: Top Stats - 3 in 1 Block
Post by: Jadzia on October 04, 2007, 03:16:44 AM
Hi Wilsy

Do you mind if others use the code you pasted?  It is EXACTLY what I have been looking for  :up:

Cheers

Jadzia
Title: Re: Top Stats - 3 in 1 Block
Post by: wilsy on October 06, 2007, 09:10:28 AM
Hi Jadzia,

Feel free, I got the code myself from TP ;)

Regards,

Wilsy.
Title: Re: Top Stats - 3 in 1 Block
Post by: DeviantQueen on October 14, 2007, 09:07:12 PM
http://deviantmetal.com/forum/index.php?page=44

Here's what I have, I put it in a PHP article.

It doesn't show the name correctly if there is a space present. Example, member name: Elemental Dragon displays as ElementalÃ,·Dragon

Is there any way to correct this?

global $db_prefix, $memberContext;

$count = 2;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><b>Newest Members</b></font></td><td bgcolor="#660066" width="200"><font color="#FFFFFF" face="Verdana" size="2"><b>Top 10 Posters</b></font></td><td  bgcolor="#336699"><font color="#FFFFFF" face="Verdana" size="2"><b>Top Posters This Week</b></font></td><td  bgcolor="#00CC33"><font color="#FFFFFF" face="Verdana" size="2"><b>This Months Birthdays</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://brianjwilson.com/forum/noava.gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

global $scripturl;
echo'</td><td>';
$numberofposters = 10; // You can change this to however many you want

$request = db_query("
  SELECT ID_MEMBER, memberName, posts
  FROM {$db_prefix}members
  ORDER BY posts DESC
  LIMIT $numberofposters", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
  echo '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['memberName'] . '</a>' , ' (', $row['posts'] , ')<br />';
mysql_free_result($request);
echo'</td><td>';

global $db_prefix;
$count= array();

$query = db_query(
    "SELECT posterName
     FROM {$db_prefix}messages
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['posterName']]))
    $count[$row['posterName']] = 0;
  ++$count[$row['posterName']];
}

$random = array_rand($count, count($count));
echo '<div style="text-align: center">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  $name = str_replace(" ",'Ã,·',$value);
  echo '<span style="font-size:' . $fsize . 'pt;">' . $name . '</span> ';
}
echo '</div></td><td>';
global $db_prefix, $scripturl;

echo '
  <div style="padding: 4px; font-weight: bold;">';
echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month = date('m');
      $month_number = '-' . $month . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    $birthdays = array();
    $member = array();
    while ($row = mysql_fetch_assoc($query))
    {
       $day = substr($row['birthdate'],8,2);
       $birthdays[$row['memberName']] =  $day;
       $member[$row['memberName']] = $row['ID_MEMBER'];
    }
    asort($birthdays);
    foreach ($birthdays as $key => $value)
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a> (' . $value . '.' . $month . ')<br />';
   }
}
else
  echo 'No birthdays this month';
echo'</div> ';
echo'</td></tr>
</table>';
Title: Re: Top Stats - 3 in 1 Block
Post by: rockyrails on October 31, 2007, 02:48:46 AM
Here is the code I ended up modifying from multiple posts to this thread :
Used it in php center block. Effect is 3in1 stats block showing:
• 3 newest members (make sure you add your url to the default avatar.gif
• 25 top posters
• the last 7 days most active posters
all three blocks are centered and the content is centered - looks much better that way.

• in the last 7 days top posters the display name is used and not the registered name, also the odd A symbol is removed and a space is show where members are using two words in their display name. I added a screen shot (50%) to save space and the code in a text file.
The code is not mine it is merely an adaptation from all the great input in this thread and a few others on the forum. Thanks for the great block code - nice addition to the site and may inspire a few members to post more.

global $db_prefix, $memberContext;

$count = 3;
$users = array();

$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="1" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#FF9900" width="150"><font color="#FFFFFF" face="Verdana" size="2"><center><b>Newest Members</b></center></font></td><td bgcolor="#6c4614" width="125"><font color="#FFFFFF" face="Verdana" size="2"><center><b>Top 25 Posters</b></center></font></td><td  bgcolor="#68715b" width="125"><font color="#FFFFFF" face="Verdana" size="2"><center><b>This Weeks Top Posters</b></center></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '<hr>';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]['avatar']['image']))
echo '<div align="center">'.$memberContext[$user_id]['avatar']['image'].'<BR>'.$memberContext[$user_id]['link'].'</div>';
else
echo '<div align="center"><img src="http://www.link_to_the_image_you_want_as_default_gif" height=80 widh=80><BR><BR>'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 25; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo '<div align="center">'.$poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';
global $db_prefix, $scripturl;
$count= array();
$poster_number = array();
$query = db_query(
    "SELECT realName, {$db_prefix}messages.ID_MEMBER, ID_GROUP
     FROM {$db_prefix}members
     JOIN {$db_prefix}messages
     ON {$db_prefix}members.ID_MEMBER = {$db_prefix}messages.ID_MEMBER
     WHERE ID_GROUP <> 1 AND ID_GROUP <> 2
     ORDER BY posterTime DESC
     LIMIT 100", __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($query))
{
  if (!isset($count[$row['realName']]))
    $count[$row['realName']] = 0;
  ++$count[$row['realName']];
    $poster_number[$row['realName']] = $row['ID_MEMBER'];
}

$random = array_rand($count, count($count));
echo '<div align="center"><div style="width: 160px; text-align: center; overflow: hidden;">';
foreach ($random as $value)
{
  $fsize = $count[$value] + 7;
  if ($fsize > 20)
    $fsize = 20;
  elseif ($fsize < 6)
    $fsize = 6;
  $name = str_replace(" ",' ',$value);
   echo '<div align="center"><a style="font-size:' . $fsize . 'pt;" class="normaltext" href="' . $scripturl . '?action=profile;u=' . $poster_number[$value] . ';sa=showPosts">' . $name . '</a> ';
}
echo '</div></td></tr>
</table>';



Title: Re: Top Stats - 3 in 1 Block
Post by: MinasC on October 31, 2007, 08:59:24 AM
could you plz attach a bigger pic , i cannot make out what that one shows !
thnx !
Title: Re: Top Stats - 3 in 1 Block
Post by: rockyrails on October 31, 2007, 11:01:57 AM
Larger pic added to the original post - thanks

Title: Re: Top Stats - 3 in 1 Block
Post by: MinasC on October 31, 2007, 11:29:13 AM
that's ok now , thnx !
Title: Re: Top Stats - 3 in 1 Block
Post by: DeviantQueen on October 31, 2007, 09:25:31 PM
Looks great!! Thanks!!

just one little thing, not sure if it can be fixed

http://deviantmetal.com/forum/index.php?page=52

DarkCelticLi  -- his username is DarkCelticLion but it cut's off... can that be fixed? what would need to be changed?
Title: Re: Top Stats - 3 in 1 Block
Post by: rockyrails on October 31, 2007, 09:43:00 PM
Hi
Try increasing the width - I had set it pretty narrow as my center area is only 540px wide
in: I had it originally at 125 - make it either 200 or 250

<td  bgcolor="#68715b" width="125"><font color="#FFFFFF" face="Verdana" size="2"><center>This Weeks Top Posters</center></font></td>

hope this helps - cheers
Title: Re: Top Stats - 3 in 1 Block
Post by: DeviantQueen on November 01, 2007, 01:00:11 PM
That did help, thank you! Though that isn't the one I had to change

"echo '<div align="center"><div style="width: 160px; text-align: center; overflow: hidden;">';"
Title: Re: Top Stats - 3 in 1 Block
Post by: wilsy on January 30, 2008, 06:37:24 PM
This will give you: -

Latest Boys | Top Posters | Latest Girls | Birthdays | Top Gamers

global $db_prefix, $memberContext, $modSettings, $scripturl;


$count = 20;
$users = array();


$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND gender = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="0" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Latest Boys</b></font></td><td bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Top 10</b></font></td><td  bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Latest Girls</b></font></td><td  bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Birthdays</b></font></td><td bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Top Gamers</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]))
echo '<div align="left">'.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 20; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix, $memberContext, $modSettings, $scripturl;


$count = 20;
$users = array();


$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND gender = 2 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]))
echo '<div align="left">'.$memberContext[$user_id]['link'].'</div>';
}

echo '</div></td><td>';
global $db_prefix, $scripturl;

echo '
  <div style="padding: 4px; font-weight: bold;">';
// echo $title;
echo '
  </div>
  <div class="windowbg" style="padding: 4px; ">';
      $month = date('m');
      $month_number = '-' . $month . '-';
      $query = db_query(
    "SELECT ID_MEMBER, memberName, birthdate
     FROM {$db_prefix}members
     WHERE birthdate LIKE '%$month_number%'
     AND birthdate NOT LIKE '0001-01-01'
     ORDER BY memberName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    $birthdays = array();
    $member = array();
    while ($row = mysql_fetch_assoc($query))
    {
       $day = substr($row['birthdate'],8,2);
       $birthdays[$row['memberName']] =  $day;
       $member[$row['memberName']] = $row['ID_MEMBER'];
    }
    asort($birthdays);
    foreach ($birthdays as $key => $value)
    {
      echo '<a class="normaltext" href="' . $scripturl . '?action=profile;u=' . $member[$key] . '">' . $key . '</a> (' . $value . '.' . $month . ')<br />';
   }
}
else
  echo 'No birthdays this month';

echo'</td><td>';

//-------START-------------
/*
|----------------------------------
SMF ARCADE SCROLLING CHAMPS BLOCK for SMFARCADE V2
by Eric Lawson
|----------------------------------
Made for TinyPortal and SMF forum

*/
//Upload a pic called arcade_block.gif (you can use you own gif - just name it arcade_block.gif)
//to your Themes/<themename>/images/ folder

// -- SETUP EDITS ---

$no = 20; //number of top players to show

// --LANGUAGE EDITS --
$txtplay = "The Top Players"; // change "The Top Players" to your language
$txtwin = "Number Of Wins :";// change "Number Of Wins :" to your language
$txtlate = "Latest High Score by ";// change "Latest High Score set by" to your language
$txtwit = "with ";// change "with" to your language
$txton = "on ";// change "on" to your language

global $scripturl,$sourcedir,$boardurl,$db_prefix,$modSettings;
require_once($sourcedir.'/ArcadeStats.php');

//Get newest champ or die
$sql = "SELECT game.ID_GAME, game.gameName, game.thumbnail, game.gameDirectory,
        IFNULL(mem.ID_MEMBER, 0) AS ID_MEMBER, IFNULL(mem.realName,'') AS realName, score.score
        FROM {$db_prefix}arcade_scores AS score
        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = score.ID_MEMBER)
        JOIN {$db_prefix}arcade_games AS game ON (game.ID_GAME = score.ID_GAME)
        ORDER BY `championFrom` DESC
        LIMIT 0,1";
if(!($result = db_query($sql,__FILE__,__LINE__)))
{
die("Could not get the newest champ");
}
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

if(isset($row['gameDirectory']))
{
$row['gameDirectory']=$row['gameDirectory']."/";
}

//newest champ details
$playerid = $row['ID_MEMBER'];
$player = $row['realName'];
$game_id = $row['ID_GAME'];
$game_name = $row['gameName'];
$score = $row['score'];
$game_pic = $modSettings['gamesUrl'].$row['gameDirectory'].$row['thumbnail'];

$bp=ArcadeStats_BestPlayers($no);

$score_poss=0; //players position

echo '
<script type="text/javascript">';

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
//Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
//Specify marquee scroll speed (larger is faster 1-10)
//Pause marquee onMousever (0=no. 1=yes)?
echo '
var delayb4scrollx=2000
var marqueespeedx=1
var pauseitx=1';

////NO NEED TO EDIT BELOW THIS LINE////////////
echo '
var copyspeedx=marqueespeedx
var pausespeedx=(pauseitx==0)? copyspeedx: 0
var actualheightx=\'\'';
echo '
function scrollmarqueex(){
if (parseInt(cross_marqueex.style.top)>(actualheightx*(-1)+8))
cross_marqueex.style.top=parseInt(cross_marqueex.style.top)-copyspeedx+"px"
else
cross_marqueex.style.top=parseInt(marqueeheightx)+8+"px"
}

function initializemarqueex(){
cross_marqueex=document.getElementById("vmarqueex")
cross_marqueex.style.top=0
marqueeheightx=document.getElementById("marqueecontainerx").offsetHeight
actualheightx=cross_marqueex.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
cross_marqueex.style.height=marqueeheightx+"px"
cross_marqueex.style.overflow="scroll"
return
}
setTimeout(\'lefttime=setInterval("scrollmarqueex()",30)\', delayb4scrollx)
}

if (window.addEventListener)
window.addEventListener("load", initializemarqueex, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarqueex)
else if (document.getElementById)
window.onload=initializemarqueex

</script>';

echo '<table width="100%">
<tr>
<td align="center">

</td>
</tr>
</table>
<div id="marqueecontainerx" style="position: relative; width: 95%; height:250px; overflow: hidden; border: 0px; padding: 2px; padding-left: 4px;" onmouseover="copyspeedx=pausespeedx" onmouseout="copyspeedx=marqueespeedx">
<div id="vmarqueex" style="position: absolute; width: 98%;">
<div align="center">
<a href="',$scripturl,'?action=arcade;sa=play;game=',$game_id,'"><img src="',$game_pic,'" border="0" alt="',$game_name,'" width="60" height="60"/></a>
<br />',$txtlate,'<br />
<a href="',$scripturl,'?action=profile;u=',$playerid,'">',$player,'</a>
<br/>',$txtwit,' ',$score,' ',$txton,'<br />',$game_name,'
<br />------------------<br />',$txtplay,'<br /><br />';
foreach ($bp as $out)
{
$score_poss++;
echo '',$score_poss,' - ',$out['link'],'<br />',$txtwin,' ',$out['champions'],'
     <br /><br />';
};
echo '</div>
</div>
</div>';

//---------END--------------
$memberContext = array();
echo'</td></tr>
</table>';


Regards,

Wilsy.
Title: Re: Top Stats - 3 in 1 Block
Post by: wilsy on February 02, 2008, 11:58:35 AM
I've been playing again with this block, it's excellent! I now have: -

Latest Boys, Top 20 Posters, Latest Girls, Latest Posts, Forum Categories/Boards/Search

Demo at www.rewindlancs.com in frontpage block (guests can view).

global $db_prefix, $memberContext, $modSettings, $scripturl;


$count = 20;
$users = array();


$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND gender = 1 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
echo'<table border="0" width="100%" id="table1" cellpadding="2" style="border-collapse: collapse">
<tr><td  bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Latest Boys</b></font></td><td bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Top 20</b></font></td><td  bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Latest Girls</b></font></td><td  bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Latest Posts</b></font></td><td bgcolor="#eae9e9" width="20%"><font color="#16b7c5" face="Verdana" size="2"><b>Community</b></font></td></tr><tr>
<td>';
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]))
echo '<div align="left"><img src="http://rewindlancs.com/forum/Themes/OverViewLight_tp/images/Male.gif"/> '.$memberContext[$user_id]['link'].'</div>';
}

$numberofposters = 20; // You can change this to however many you want

require_once "SSI.php";
$top_posters = ssi_topPoster($numberofposters, "return");
echo'</td><td>';
foreach ($top_posters as $poster)
{
  echo $poster['link'] , ' (', $poster['posts'] , ')<br />';
}
echo'</td><td>';

global $db_prefix, $memberContext, $modSettings, $scripturl;


$count = 20;
$users = array();


$request = db_query("
SELECT ID_MEMBER FROM {$db_prefix}members WHERE is_activated = 1 AND gender = 2 ORDER BY ID_MEMBER DESC LIMIT ".$count, __FILE__, __LINE__);

while ($row = mysql_fetch_assoc($request)) {
$users[] = intval($row['ID_MEMBER']);
}

loadMemberData($users);
$i = 0;
foreach($users as $user_id) {
if ($i > 0) echo '';
$i++;

loadMemberContext($user_id);

if (!empty($memberContext[$user_id]))
echo '<div align="left"><img src="http://rewindlancs.com/forum/Themes/OverViewLight_tp/images/Female.gif"/> '.$memberContext[$user_id]['link'].'</div>';
}

echo '</div></td><td>';


    // is it a number?
//if(!is_numeric($context['TPortal']['recentboxnum']))
$context['TPortal']['recentboxnum']='20';

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb=array($modSettings['recycle_board']);
else
$bb=array();

$what=ssi_recentTopics($num_recent = $context['TPortal']['recentboxnum'], $bb, $output_method = 'array');
// Output the topics
$counter=1; $cmax=count($what);
foreach($what as $w){
echo '
<a href="'.$w['href'].'">'.shorten_subject($w['short_subject'], 10).'</a><br>
';
$counter++;
}

echo'</td><td>';

global $db_prefix, $context, $user_info, $scripturl;

if (!isset($context['jump_to']))
{
// Find the boards/cateogories they can see.
$request = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = mysql_fetch_assoc($request))
{
if ($this_cat['id'] != $row['ID_CAT'])
{
$this_cat = &$context['jump_to'][];
$this_cat['id'] = $row['ID_CAT'];
$this_cat['name'] = $row['catName'];
$this_cat['boards'] = array();
}

$this_cat['boards'][] = array(
'id' => $row['ID_BOARD'],
'name' => $row['boardName'],
'child_level' => $row['childLevel'],
'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board']
);
}
mysql_free_result($request);
}

foreach ($context['jump_to'] as $category)
{
echo '<span class="smalltext" style="text-decoration: underline; font-weight: bold;">', $category['name'], '<br /></span>';
foreach ($category['boards'] as $board)
echo '<span class="smalltext"><a href="' . $scripturl . '?board=' . $board['id'] . '.0">'. str_repeat('..', $board['child_level'] + 1) . $board['name'] . '</a><br /></span>';
}
TPortal_searchbox();
echo '</td></tr>
</table>';


NOTE: You will need to replace these two lines with the url of your male/female icons: -

<img src="http://rewindlancs.com/forum/Themes/OverViewLight_tp/images/Female.gif"/>

<img src="http://rewindlancs.com/forum/Themes/OverViewLight_tp/images/Male.gif"/>

Regards,

Wilsy.
Title: Re: Top Stats - 3 in 1 Block
Post by: Lord Anubis on February 02, 2008, 02:21:30 PM
Nicely done Wilsy! 
Title: Re: Top Stats - 3 in 1 Block
Post by: rockyrails on February 02, 2008, 02:25:52 PM
Very cool variation - works really well with your site.
cheers Ferd   :up:
Title: Re: Top Stats - 3 in 1 Block
Post by: alhaudhie on May 12, 2008, 03:45:54 AM
how can i make it to put in top 10 poster only the user have posting under 100?
Title: Re: Top Stats - 3 in 1 Block
Post by: jepot on July 06, 2008, 05:00:36 AM
how to put an underline on each heading of the table?
Title: Re: Top Stats - 3 in 1 Block
Post by: jdvarner on October 26, 2008, 04:42:15 AM
i would like to just get the top posters for the day? anyone got code for that? thanks.
Title: Re: Top Stats - 3 in 1 Block
Post by: stigmartyr on January 21, 2010, 04:05:48 AM
What would I have to change to get this to work with SMF2?  I've tried digging around in SSI.php and only got myself into trouble.

Many thanks in advance.
Title: Re: Top Stats - 3 in 1 Block
Post by: IchBin on January 21, 2010, 05:36:19 AM
TP for SMF2 isn't even out, what do you need this for?

You'll have to convert all the database calls in the code to the SMF2 functions. That's why it won't work.
Title: Re: Top Stats - 3 in 1 Block
Post by: stigmartyr on January 21, 2010, 06:47:39 AM
Quote from: IchBinâ„¢ on January 21, 2010, 05:36:19 AM
TP for SMF2 isn't even out, what do you need this for?

You'll have to convert all the database calls in the code to the SMF2 functions. That's why it won't work.

Hi Ich - that's what I was having trouble with I don't know exactly what needs to be changed where.  I started poking around in the SSI.php of my SMF 2 instance.  I have a sandbox up and I wanted to try to get that working.  There's the 3 functions it does but I couldn't seem to figure it out :(
Title: Re: Top Stats - 3 in 1 Block
Post by: JPDeni on January 21, 2010, 07:21:33 PM
The code for the stats is designed to be in a TinyPortal block. You can't have a TinyPortal block at the moment if you are running SMF 2.0. Therefore, you can't use the code for the stats with SMF 2.0. Once TinyPortal is available for SMF 2.0, we will be upgrading the code for all blocks, as needed.