Online recently w/ scrolling avatars
I got this code from here at SP a while back ( i cant find it now )
everything was working great until i updated from SP ver 2.2 to 2.3
it continues to work ok on my site but i cant update it ( Syntax error in block code. Please check the code. )
or make any changes to it whatsoever.
I am running smf 1.1.8 with SP 2.3 - I have already updated to latest release with no results and reverted back
due to newest release breaking other elements of my site.
Please help !!!!
global $memberContext, $db_prefix, $scripturl, $modSettings;
/* ### CONFIGURATION OPTIONS ### */
// Set time limit using seconds
// 1 hour = 3600
// 1 day = 84600
$timelimit = 21150;
// Set the height and width of avatars
// This will resize the avatars to be more uniform
$width = "40px";
$height = "40px";
// Set or change the style of all the elements
echo '<style type="text/css">
.avatar_column
{
border: 0;
}
.avatar_column td
{
height: 60px;
width: 60px;
overflow: hidden;
text-align: center;
vertical-align: top;
}
.default
{
border: 2px solid black;
}
.he
{
border: 2px solid blue;
}
.she
{
border: 2px solid pink;
}
</style>';
/* ### END CONFIGURATION OPTIONS ### */
// Load all users who have logged in within $timelimit
$result = db_query("
SELECT mem.ID_MEMBER, mem.showOnline, mem.lastLogin, mem.realName, mem.avatar, mem.gender, a.ID_ATTACH, a.attachmentType, a.filename
FROM ({$db_prefix}members as mem)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
WHERE mem.lastLogin > (UNIX_TIMESTAMP() - $timelimit)
ORDER BY mem.lastLogin DESC", __FILE__, __LINE__);
$users = array();
// Loop through the results to display the users avatar
while ($row = mysql_fetch_assoc($result))
{
$users[$row['ID_MEMBER']] = array (
'id' => $row['ID_MEMBER'],
'href' => $scripturl.'?action=profile;u='.$row['ID_MEMBER'],
'name' => $row['realName'],
'show' => $row['showOnline'],
'gender' => $row['gender'],
'avatar' => array(
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? 'src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['realName'].'" />' : '') : (stristr($row['avatar'], 'http://') ? 'src="' . $row['avatar'] . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['realName'].'" />' : 'src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" border="0" width="'.$width.'" height="'.$height.'" title="'.$row['realName'].'" />'),
),
);
}
mysql_free_result($result);
echo '<center><table table style="border: solid #000000 1px;" bgcolor="#aaaaaa" cellpadding="3"><tr>
<td style="border: solid #000000 1px;" bgcolor="#be9794">
<a href="http://mysite/index.php?action=who"> User Log </a></td>
<td style="border: solid #000000 1px;" bgcolor="#94be98">
<a href="http://mysite/index.php?action=stats"> Stats </a></td>
<td style="border: solid #000000 1px;" bgcolor="#949ebe">
<a href="http://mysite/index.php?action=mlist"> Members</a></td>
</tr></table>
</center>
';
echo '
<marquee direction="left" scrolldelay="200">
<table class="avatar_column">
<tr>';
foreach ($users as $user)
{
if ($user['show'] == 1)
{
switch ($user['gender'])
{
case 0:
$css = "default";
break;
case 1:
$css = "he";
break;
case 2:
$css = "she";
break;
}
echo '
<td>',(empty($user['avatar']['image']) ? '<a href="'.$user['href'].'"><img class="'.$css.'" src="'.$settings['images_url'].'/default_avatar.gif" width="'.$width.'" height="'.$height.'" alt="" title="'.$user['name'].'" /></a><br>'.$user['name'].' ' : '<a href="'.$user['href'].'"><img class="'.$css.'" '.$user['avatar']['image'].'</a><br>'.$user['name'].' '),'</td>';
}
}
echo '
</tr>
</table>
</marquee>';