Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Fizzy on July 10, 2004, 03:39:46 AM

Title: Online User's avatars rotation
Post by: Fizzy on July 10, 2004, 03:39:46 AM
Here's a thought for a possible mod.

At the top of the default theme the "user info" section shows our own avatar. That's great, but I already know who I am and I already know that I'm online in teh forum.
How about if it showed the avatars of the other members online instead of our own avatar, rotating through the online list with each click in the same way as the "news box" changes the text?

[edit] changed topic title [/edit]
Title: Re: Who's online avatars
Post by: Vinoth on July 10, 2004, 03:56:31 AM
hmmmmm

idea is nice, but we have one below which shows users online/

so it is just waste of time for developers,
Title: Re: Who's online avatars
Post by: Fizzy on July 10, 2004, 05:16:02 AM
 ::) In your opinion.

Well the users online only shows in Board Index only, doesn't it, therefore you only know who's online when you are there, not when you are in the middle of a board actually posting (which is where I happen to spend most on my time, not gazing at Board Index)

Reading this, look down. I don't see who's online ! If you do then I must be doing something wrong.

On Yabbse we were able to include who's online in the forum just under the news section using the 'User Browsing' mod kindly provided by Spaceman Spiff , It might be nice to take that one stage further for SMF :)
Title: Re: Who's online avatars
Post by: damo1065 on July 11, 2004, 07:20:46 PM
There was a feature like this on the Yabb Forums down the bottom right of the forumboard. I actually thought this was cool - it had the last 5 people online and their avatars.

Nice feature - would be cool! ;D
Title: Re: Who's online avatars
Post by: emrys on July 11, 2004, 07:46:00 PM
Ok do you mean with thier names on the Board Index stats area?
Title: Re: Who's online avatars
Post by: Lord_Novice on July 31, 2004, 02:06:26 AM
I like seeing my avatar at the top...
So i know wich avatar im using and if im online or not =P
and cuz i like my avatars, so looking at them doesnt kill me...
And even if it did, i wouldnt be able to complain anymore ;)
Title: Re: Who's online avatars
Post by: Senkusha on August 03, 2004, 06:49:23 AM
LOL, I just got done doing this on my site (http://www.ayeka.net), although this is displayed on the side menu bar instead of where Users Online is, and it displays all users that have logged in since midnight (local board time).  Check it out.  I may be able to modify it to fit your needs.
Title: Re: Who's online avatars
Post by: damo1065 on August 03, 2004, 09:40:50 PM
Quote from: Senkusha on August 03, 2004, 06:49:23 AM
LOL, I just got done doing this on my site (http://www.ayeka.net), although this is displayed on the side menu bar instead of where Users Online is, and it displays all users that have logged in since midnight (local board time).  Check it out.  I may be able to modify it to fit your needs.

Yeah that's what I'm talking about!!! It's sweet - it's like a YaBB forum before which had the last 5 people to have visited...their avatars down the bottom - very nice what you've done!
Title: Re: Who's online avatars
Post by: Senkusha on August 03, 2004, 09:57:10 PM
Just let me know exactly (what to display, where, order, ...) what you need, and I'll see what I can do for you.  ;)
Title: Re: Who's online avatars
Post by: damo1065 on August 11, 2004, 11:31:22 AM
Quote from: Senkusha on August 03, 2004, 09:57:10 PM
Just let me know exactly (what to display, where, order, ...) what you need, and I'll see what I can do for you.  ;)

I 'd like to display the last 5 members with their avatars that have visited the forums. Down the bottom of the forum page.....between forum stats and mebers online. And when they visited.

:D
Title: Re: Who's online avatars
Post by: babylonking on August 11, 2004, 11:42:26 AM
Hi Senkusha

Can you share the code here!

Thanks  :)
Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 11:49:13 AM
Sure!  Just to be specific, do you want the five most recent online members or just the five most recent members?
Title: Re: Who's online avatars
Post by: babylonking on August 11, 2004, 11:52:06 AM
Quote from: Senkusha on August 11, 2004, 11:49:13 AM
Sure!  Just to be specific, do you want the five most recent online members or just the five most recent members?

the most recent online should be fine  :)
Title: Re: Who's online avatars
Post by: Vinoth on August 11, 2004, 12:06:08 PM
ah senuska

i need users online in 24 hrs, can u share the code for this one.

Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 12:15:30 PM
Quote from: whtgoogle on August 11, 2004, 12:06:08 PM
ah senuska

i need users online in 24 hrs, can u share the code for this one.

How, and where would you like this to display?
Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 12:55:09 PM
Quote from: babylonking on August 11, 2004, 11:52:06 AM
Quote from: Senkusha on August 11, 2004, 11:49:13 AM
Sure!  Just to be specific, do you want the five most recent online members or just the five most recent members?

the most recent online should be fine  :)

Here is the code to add the avatars to the listing. Note this code is for all Online members:

Open BoardIndex.php and find:

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);

$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_users_hidden'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']))
{
$context['num_users_hidden']++;
continue;
}


Replace it with the following code:

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);


$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_users_hidden'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']))
{
$context['num_users_hidden']++;
continue;
}
// The user Avatar...
if ($row['avatar'] == '')
$link = '&nbsp;<br>';
elseif (strtoupper(substr($row['avatar'],0,7)) == 'HTTP://')
$link = '<img src="' . $row['avatar'] . '" height="40"><br>';
else
$link = '<img src="' . $modSettings['avatar_url'] . '/' . $row['avatar'] . '" height="40"><br>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';



And delete the following (repeated lines at the bottom now):

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';


Now if you want to limit this query to only five members, change this:

$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);


to this:

$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP)) LIMIT 5", __FILE__, __LINE__);


That should do the trick for you.  Make sure you make a backup copy of the BoardIndex.php file!  I have tested this on my board, but since I only had myself active at the time, I can not gauntee that it works.

Let me know if you have any problems.
Title: Re: Who's online avatars
Post by: babylonking on August 11, 2004, 01:31:42 PM
Can this be done with SSI cuz i want to add this code in my main web site page?
Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 01:35:10 PM
Let me look into that.  I'm sure anything is possible with SSI, but I really haven't explored it too much.

How would you like the avatar, members displayed?  Any other information to be displayed?
Title: Re: Who's online avatars
Post by: babylonking on August 11, 2004, 01:41:31 PM
Quote from: Senkusha on August 11, 2004, 01:35:10 PM
Let me look into that.  I'm sure anything is possible with SSI, but I really haven't explored it too much.

How would you like the avatar, members displayed?  Any other information to be displayed?

just the members name & Posts  ;)

Thanks again  :)
Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 03:06:38 PM
Okay so you want something like this:

Each member listed, next to the number of total or posts for the day? (If I can compute that), and all these members have been active at least once during the past 24 hours?  Using SSI.

Quote
Member1 (202)
Member2 (54)
Member3 (9)
Member4 (1,234)
...
Title: Re: Who's online avatars
Post by: babylonking on August 11, 2004, 03:35:36 PM
Quote from: Senkusha on August 11, 2004, 03:06:38 PM
Okay so you want something like this:

Each member listed, next to the number of total or posts for the day? (If I can compute that), and all these members have been active at least once during the past 24 hours?  Using SSI.

Quote
Member1 (202)
Member2 (54)
Member3 (9)
Member4 (1,234)
...


sure thats should be super  :)
Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 04:17:07 PM
Okay then, I'll probably create a new SSI function.  Since the current function looks at the log table (which only includes members that have been active with in (15 minutes).  I'll be looking at the last login time for each member.  Do you want the total number of posts for each member or the number of posts per member for the 24 hour range?  Also, do you want the number of Guests and total members listed displayed too?
Title: Re: Who's online avatars
Post by: babylonking on August 11, 2004, 06:34:06 PM
Quote from: Senkusha on August 11, 2004, 04:17:07 PM
Okay then, I'll probably create a new SSI function.  Since the current function looks at the log table (which only includes members that have been active with in (15 minutes).  I'll be looking at the last login time for each member.  Do you want the total number of posts for each member or the number of posts per member for the 24 hour range?  Also, do you want the number of Guests and total members listed displayed too?

just the total number of posts for each member and the last 5 members with their avatars that have visited the forums  :)
Title: Re: Who's online avatars
Post by: Senkusha on August 11, 2004, 10:13:10 PM
Oh, okay, so you want this lined up  along the side, or top/bottom of the page? Also do you want it to be like:


Avatar     MemberName
               totalPosts


I'm sorry I'm asking a lot of questions, but it really is for the best to get it right the first time  ;)
Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 01:05:41 AM
Quote from: Senkusha on August 11, 2004, 10:13:10 PM
Oh, okay, so you want this lined up  along the side, or top/bottom of the page? Also do you want it to be like:


Avatar     MemberName
               totalPosts


I'm sorry I'm asking a lot of questions, but it really is for the best to get it right the first time  ;)

Top/Bottom cuz i use left side menu in my forum......... I want some thing like the sample below  :)

Avatar   
MemberName
totalPosts
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 05:29:47 AM
Ok, I should have something to you in a few hours.  ;)
Title: Re: Who's online avatars
Post by: Vinoth on August 12, 2004, 07:44:05 AM
at the bottom, where no of users are online,

i need there an another column which would display the users visited today to the board!
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 09:06:20 AM
Quote from: whtgoogle on August 12, 2004, 07:44:05 AM
at the bottom, where no of users are online,

i need there an another column which would display the users visited today to the board!

So you want something like this:

Avatar
MemberName

Avatar
MemberName

Where the first row is the online (last five) members, and the second row is all the members that have been active since midnight?
Title: Re: Who's online avatars
Post by: Vinoth on August 12, 2004, 09:10:52 AM
Yes indeed!

can u do that , i will be very much thankfull to you!
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 09:58:20 AM
Quote from: whtgoogle on August 12, 2004, 09:10:52 AM
Yes indeed!

can u do that , i will be very much thankfull to you!

Yes, I can do that, I've got something like that on my site, and I'm modifiing SSI for babylonking to include something like this.  It'll be a few hours though.
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 10:47:35 AM
Quote from: babylonking on August 12, 2004, 01:05:41 AM
Quote from: Senkusha on August 11, 2004, 10:13:10 PM
Oh, okay, so you want this lined up  along the side, or top/bottom of the page? Also do you want it to be like:


Avatar     MemberName
               totalPosts


I'm sorry I'm asking a lot of questions, but it really is for the best to get it right the first time  ;)

Top/Bottom cuz i use left side menu in my forum......... I want some thing like the sample below  :)

Avatar   
MemberName
totalPosts

okay, check out the test page:  test SSI Recent (http://www.ayeka.net/test.php) and let me know what you think.
Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 04:24:44 PM
Quoteokay, check out the test page:  test SSI Recent and let me know what you think.

Very nice Senkusha i really like it  :)
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 05:03:12 PM
Okay then, add this function to your SSI.php file (I chose right underneath ssi_WhosOnline.


// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin <= '$midnight'
ORDER BY mem.realName", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<table border="0" align="center">';

// The user Avatar...
if ($tmp['avatar'] == '')
$link .= '
<tr>
<td valign="bottom">&nbsp;</td>
</tr>';
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<tr>
<td valign="bottom"><img src="' . $tmp['avatar'] . '" height="40"></td>
</tr>';
else
$link .= '
<tr>
<td valign="bottom"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td>
</tr>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td valign="bottom" nowrap><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></td>
</tr>';
else
$link .= '
<tr>
<td valign="bottom" nowrap><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td valign="bottom">' . $tmp['posts'] . '</td>
</tr>';

$link .= '
</table>
</td>';

$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left"><tr>';
$t=0;
foreach ($return['users'] as $user)
{
if ($t == 0)
echo '<td valign="bottom">';
if ($t > 5)
{
echo '</td></tr><tr><td valign="bottom">';
$t = 0;
}
echo $user['link'], !$user['is_last'] ? '<td valign="bottom">' : '';
$t ++;
}
echo '</td></tr></table>';
}


Then add the function ssi_WhosRecent () to your webpage.  I hope it works for ya!

Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 05:36:55 PM
thanks Senkusha the code is working fine but how i limit the members to 5  active at least once during the past 24 hours.
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 06:03:19 PM

// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin <= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);
Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 06:13:32 PM
Thanks Senkusha .........Two more thing please  :D

I want to Load the users online for the past 5 hours & the members name i want them to display  top/bottom like the sample below.

faridgorges
Posts: 0

Bazneta
Posts: 0

tobeya
Posts: 0
Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 06:26:14 PM
Senkusha the uploaded avatars by members is not working  ::)
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 08:11:24 PM
Quote from: babylonking on August 12, 2004, 06:13:32 PM
Thanks Senkusha .........Two more thing please  :D

I want to Load the users online for the past 5 hours & the members name i want them to display  top/bottom like the sample below.

faridgorges
Posts: 0

Bazneta
Posts: 0

tobeya
Posts: 0


So do you want this instead of the 'top/bottom ssi function?' or is this another ssi function?
Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 08:11:51 PM
Quote from: babylonking on August 12, 2004, 06:26:14 PM
Senkusha the uploaded avatars by members is not working  ::)

What is it doing, and not doing?
Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 08:27:52 PM
QuoteSo do you want this instead of the 'top/bottom ssi function?' or is this another ssi function?

Just like the one in your web site left menu " 5 Recent Members "

QuoteWhat is it doing, and not doing?

only the hosted avatars is showing the uploaded avatars is not showing.

http://www.babylonking.net/include44.php

Title: Re: Who's online avatars
Post by: Senkusha on August 12, 2004, 09:09:36 PM
Quote from: babylonking on August 12, 2004, 08:27:52 PM
QuoteSo do you want this instead of the 'top/bottom ssi function?' or is this another ssi function?

Just like the one in your web site left menu " 5 Recent Members "

QuoteWhat is it doing, and not doing?

only the hosted avatars is showing the uploaded avatars is not showing.

http://www.babylonking.net/include44.php



Okay, the simply add a LIMIT 5 to the end of the SELECT statement for the five most recent members. (My site lists ALL members since midnight).

I just realized that the uploaded avatars isn't working.  I'll see if I can find a solution, since that function is being called from anoother function.

Did that make any sense?
Title: Re: Who's online avatars
Post by: babylonking on August 12, 2004, 09:25:19 PM
Quote from: Senkusha on August 12, 2004, 09:09:36 PM
Quote from: babylonking on August 12, 2004, 08:27:52 PM
QuoteSo do you want this instead of the 'top/bottom ssi function?' or is this another ssi function?

Just like the one in your web site left menu " 5 Recent Members "

QuoteWhat is it doing, and not doing?

only the hosted avatars is showing the uploaded avatars is not showing.

http://www.babylonking.net/include44.php



Okay, the simply add a LIMIT 5 to the end of the SELECT statement for the five most recent members. (My site lists ALL members since midnight).

I just realized that the uploaded avatars isn't working.  I'll see if I can find a solution, since that function is being called from anoother function.

Did that make any sense?

Just take your time  Senkusha no rushing  ;)
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 05:21:24 AM
Na, I should have something by the end of the day.  Remember, I'm using this same technology!
Title: Re: Who's online avatars
Post by: Vinoth on August 13, 2004, 06:42:41 AM
Thanx a lot, also some other members too need this feature.
Title: Re: Who's online avatars
Post by: Elisa on August 13, 2004, 09:13:28 AM
I have tried to install the mod, but it does not work! after that I have copied the code in the rows what I must make? Help!!!
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 10:12:10 AM
Quote from: babylonking on August 12, 2004, 06:13:32 PM
Thanks Senkusha .........Two more thing please  :D

I want to Load the users online for the past 5 hours & the members name i want them to display  top/bottom like the sample below.

faridgorges
Posts: 0

Bazneta
Posts: 0

tobeya
Posts: 0


Do you still want the avatars to display?

Quote
Avatar
membername
Posts: 0

Avatar
membername
Posts: 0

btw, I got the uploaded avatars working!
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 10:40:31 AM
QuoteDo you still want the avatars to display?

sure just like the one in your web site left menu.  :)

Quotebtw, I got the uploaded avatars working!

cool ........... can't wait to added  ;)
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 10:54:58 AM
Okay, here is the code.  As is, it will display a listing down the side of your board like this:

Quote
Avatar
member
Posts:  ##
Last On:  HH:MM

It will list only the five most recent members that have been since midnight.

I would recommend adding this code just after the ssi_WhosOnline () function (since this is a modified copy of that code).  You may call this code by placing this code in your main page:

If you want to change the number of hours the query looks, change the following line:

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));

If you want to change the number of users listed change this line:

LIMIT 5", __FILE__, __LINE__);


If you want to change how this list is displayed (horizontal / vertical), then you'll need to change this line:

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo '<tr><td align="left" valign="bottom">' . $user['link'] . '</td></tr>' , !$user['is_last'] ? '' : '';
echo '</table>';

to this (note if you change the number to more than 5 members, you could have problems.):

echo '<table align="left" border="0"><tr><td valign="bottom">';
foreach ($return['users'] as $user)
echo $user['link'] , !$user['is_last'] ? '' : '';
echo '</td></tr></table>';


Quote
ssi_WhosRecent()

Find the section

// Just like whosOnline except it also logs the online presence.


right above it add:

// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<table border="0" align="left">';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40">';
$link .= '
<tr>
<td valign="bottom">&nbsp;</td>
</tr>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<tr>
<td align="center" valign="bottom"><img src="' . $tmp['avatar'] . '" height="40"></td>
</tr>';
else
$link .= '
<tr>
<td align="center" valign="bottom"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td>
</tr>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="bottom" nowrap><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="bottom" nowrap><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="bottom">Posts:&nbsp;&nbsp;' . $tmp['posts'] . '</td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="bottom">Last On:&nbsp;&nbsp;' . date("H:i", $tmp['lastLogin']) . '</td>
</tr></table>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo '<tr><td align="left" valign="bottom">' . $user['link'] . '</td></tr>' , !$user['is_last'] ? '' : '';
echo '</table>';
}


That should do it.
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 11:50:35 AM
Nice Senkusha it's working  :D


Thanks alot  :)
Title: Re: Who's online avatars
Post by: Elisa on August 13, 2004, 12:01:16 PM
I do not understand, excuse!  I modify alone the SSI.php file?  And the file of the template ones not?
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 12:58:49 PM
How i make the "members name, posts & last on text" to appear beside each members avatars just like the one in your web site. :)

Sorry for bugging you Senkusha  ::)
Title: Re: Who's online avatars
Post by: Mysterio on August 13, 2004, 12:59:14 PM
Senkusha, I tried installing the 'Avatar Online' mod, but it brought back some errors:

QuoteNotice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 271
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 272
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 273
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 274
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 275
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 279

And here is what's on lines 271-275:

         
Quote'id' => $tmp['ID_MEMBER'],
         'username' => $tmp['memberName'],
         'name' => $tmp['realName'],
         'group' => $tmp['ID_GROUP'],

And 279:

Quoteif ($tmp['onlineColor'] != '')

How do I fix that?

Thanks.
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 03:22:21 PM
Quote from: babylonking on August 13, 2004, 12:58:49 PM
How i make the "members name, posts & last on text" to appear beside each members avatars just like the one in your web site. :)

Sorry for bugging you Senkusha  ::)

Try this code instead:


// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<tr><td><fieldset><table><tr>';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = mysql_query ("SELECT * FROM smf_attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'") or die(mysql_error());
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<td><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40"></td><td><table>';
$link .= '
<td valign="middle" width="40">&nbsp;</td><td><table>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<td align="center" valign="middle"><img src="' . $tmp['avatar'] . '" height="40"></td><td><table>';
else
$link .= '
<td align="center" valign="middle"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="bottom" nowrap><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="bottom" nowrap><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="bottom">Posts:&nbsp;&nbsp;' . $tmp['posts'] . '</td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="bottom">Last On:&nbsp;&nbsp;' . date("H:i", $tmp['lastLogin']) . '</td>
</tr></table></td></tr></table></fieldset></td></tr>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</table>';
}
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 03:23:55 PM
Quote from: Mysterio on August 13, 2004, 12:59:14 PM
Senkusha, I tried installing the 'Avatar Online' mod, but it brought back some errors:

QuoteNotice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 271
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 272
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 273
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 274
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 275
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 279

And here is what's on lines 271-275:

         
Quote'id' => $tmp['ID_MEMBER'],
         'username' => $tmp['memberName'],
         'name' => $tmp['realName'],
         'group' => $tmp['ID_GROUP'],

And 279:

Quoteif ($tmp['onlineColor'] != '')

How do I fix that?

Thanks.

This mod uses SSI.  Refer to the ssi_examples.php for configuration help.  You should only need to add ssi_WhosRecent () to your main webpage.
Title: Re: Who's online avatars
Post by: Mysterio on August 13, 2004, 03:43:33 PM
I'm not talking about adding that to my website, but adding that to my forum.
Title: Re: Who's online avatars
Post by: Elisa on August 13, 2004, 03:52:21 PM
I do not succeed!  You can say me exactly as you have made?
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 04:05:43 PM
Quote from: Mysterio on August 13, 2004, 03:43:33 PM
I'm not talking about adding that to my website, but adding that to my forum.

Where about do you want to add this to your forum?  you can use this function as is.  The only thing you need to do is build a 'shell' around your forum.  Let me know if this is acceptable or if you need further help.
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 04:06:22 PM
Quote from: Elisa on August 13, 2004, 03:52:21 PM
I do not succeed!  You can say me exactly as you have made?

Explain to me what is happening, or you could link to your website so I can see what is happening.

Thanks!
Title: Re: Who's online avatars
Post by: Mysterio on August 13, 2004, 04:23:56 PM
Quote from: Senkusha on August 13, 2004, 04:05:43 PM
Where about do you want to add this to your forum? you can use this function as is. The only thing you need to do is build a 'shell' around your forum. Let me know if this is acceptable or if you need further help.

At the bottom of the forum. Like where everyone else wants it. You know, where it'll say the 5 most recent members or whatever, then displays the avatar, etc.

Tell me if you need more specific information and I'll do my best to explain it in detail.

Thanks.
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 04:43:07 PM
So then you want this code here:

Quote from: Senkusha on August 11, 2004, 12:55:09 PM
Quote from: babylonking on August 11, 2004, 11:52:06 AM
Quote from: Senkusha on August 11, 2004, 11:49:13 AM
Sure!  Just to be specific, do you want the five most recent online members or just the five most recent members?

the most recent online should be fine  :)

Here is the code to add the avatars to the listing. Note this code is for all Online members:

Open BoardIndex.php and find:

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);

$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_users_hidden'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']))
{
$context['num_users_hidden']++;
continue;
}


Replace it with the following code:

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);


$context['users_online'] = array();
$context['list_users_online'] = array();
$context['online_groups'] = array();
$context['num_guests'] = 0;
$context['num_users_hidden'] = 0;
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
{
$context['num_guests']++;
continue;
}
elseif (empty($row['showOnline']))
{
$context['num_users_hidden']++;
continue;
}
// The user Avatar...
if ($row['avatar'] == '')
$link = '&nbsp;<br>';
elseif (strtoupper(substr($row['avatar'],0,7)) == 'HTTP://')
$link = '<img src="' . $row['avatar'] . '" height="40"><br>';
else
$link = '<img src="' . $modSettings['avatar_url'] . '/' . $row['avatar'] . '" height="40"><br>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';



And delete the following (repeated lines at the bottom now):

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';


Now if you want to limit this query to only five members, change this:

$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);


to this:

$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP)) LIMIT 5", __FILE__, __LINE__);


That should do the trick for you.  Make sure you make a backup copy of the BoardIndex.php file!  I have tested this on my board, but since I only had myself active at the time, I can not gauntee that it works.

Let me know if you have any problems.
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 04:55:33 PM
Thanks Senkusha but the text still below the members avatar  ::)

here is the link http://www.babylonking.net/include44.php

and here is the code i'm using now
// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin <= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<tr><td><fieldset><table border="0"><tr>';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = mysql_query ("SELECT * FROM yabbse_attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'") or die(mysql_error());
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<td><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40"></td></td><table>';
$link .= '
<td valign="middle" width="40">&nbsp;</td><td><table>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<td align="center" valign="middle"><img src="' . $tmp['avatar'] . '" height="40"></td><td><table>';
else
$link .= '
<td align="center" valign="top"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></font></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></font></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Posts:&nbsp;' . $tmp['posts'] . '</font></td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Last On:&nbsp;' . date("H:i", $tmp['lastLogin']) . '</font></td>
</tr></table></td></tr></table></fieldset></td></tr>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</table>';
}
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 05:12:15 PM
Quote
$link .= '
<td align="center" valign="top"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

should be
Quote
$link .= '
<td align="center" valign="middle"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

Also you might want to change this:
Quote
WHERE mem.lastLogin <= '$midnight'

to this:
Quote
WHERE mem.lastLogin >= '$midnight'

Finally change this to:
Quote
$AvatarReq = mysql_query ("SELECT * FROM yabbse_attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'") or die(mysql_error());

to this: (I will be changing the code posting)
Quote
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);

That should do it.
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 05:23:10 PM
Thanks again but the text still below the members avatar  ::)

http://www.babylonking.net/include44.php

Any idea ?

// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<tr><td><fieldset><table border="0"><tr>';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<td><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40"></td></td><table>';
$link .= '
<td valign="middle" width="40">&nbsp;</td><td><table>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<td align="center" valign="middle"><img src="' . $tmp['avatar'] . '" height="40"></td><td><table>';
else
$link .= '
<td align="center" valign="middle"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></font></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></font></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Posts:&nbsp;' . $tmp['posts'] . '</font></td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Last On:&nbsp;' . date("H:i", $tmp['lastLogin']) . '</font></td>
</tr></table></td></tr></table></fieldset></td></tr>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</table>';
}
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 05:26:57 PM
Found the problem (I hope)  Try this code (I had a double </td>)


Quote from: babylonking on August 13, 2004, 05:23:10 PM
Thanks again but the text still below the members avatar  ::)

http://www.babylonking.net/include44.php

Any idea ?

// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<tr><td><fieldset><table border="0"><tr>';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<td><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40"></td><td><table>';
$link .= '
<td valign="middle" width="40">&nbsp;</td><td><table>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<td align="center" valign="middle"><img src="' . $tmp['avatar'] . '" height="40"></td><td><table>';
else
$link .= '
<td align="center" valign="middle"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></font></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></font></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Posts:&nbsp;' . $tmp['posts'] . '</font></td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Last On:&nbsp;' . date("H:i", $tmp['lastLogin']) . '</font></td>
</tr></table></td></tr></table></fieldset></td></tr>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</table>';
}

Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 05:28:58 PM
wrong one  ::)

http://www.babylonking.net/include44.php
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 05:46:46 PM
I'll have to look a bit later.  It looks like somehow the first avatar is being called, but it is skipping the information, then it is moving on to the next member, that has no avatar assigned.  If you want viewing the Source of the html document would help trouble shoot this problem.  I have to do a few things around the house for now though.
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 05:50:07 PM
Quote from: Senkusha on August 13, 2004, 05:46:46 PM
I'll have to look a bit later.  It looks like somehow the first avatar is being called, but it is skipping the information, then it is moving on to the next member, that has no avatar assigned.  If you want viewing the Source of the html document would help trouble shoot this problem.  I have to do a few things around the house for now though.

Take your time I'm also busy now fixing my dish  ;)
Title: Re: Who's online avatars
Post by: Mysterio on August 13, 2004, 06:02:32 PM
Okay, that's what I did, as well. I used that exact code to edit and replace as needed in BoardIndex.php, and those errors that I showed you is what came back.

So, I don't know what I did wrong.

Would it be possible to make the changes to you're own BoardIndex.php?

If you don't have one that's available, that's unedited and unchanged, want me to upload one that you can edit then re-upload yourself and then I can try that one out?

I'd be most appreciative if you could do that for me.

But I hear that you're busy at the moment, np... take you're time.

Thanks.
Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 06:14:51 PM
Try this one.

Quote from: Senkusha on August 13, 2004, 05:26:57 PM
Found the problem (I hope)  Try this code (I had a double </td>)


Quote from: babylonking on August 13, 2004, 05:23:10 PM
Thanks again but the text still below the members avatar  ::)

http://www.babylonking.net/include44.php

Any idea ?

// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<tr><td><fieldset><table border="0"><tr>';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<td><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40"></td><td><table>';
else
$link .= '
<td valign="middle" width="40">&nbsp;</td><td><table>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<td align="center" valign="middle"><img src="' . $tmp['avatar'] . '" height="40"></td><td><table>';
else
$link .= '
<td align="center" valign="middle"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></font></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></font></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Posts:&nbsp;' . $tmp['posts'] . '</font></td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Last On:&nbsp;' . date("H:i", $tmp['lastLogin']) . '</font></td>
</tr></table></td></tr></table></fieldset></td></tr>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</table>';
}

Title: Re: Who's online avatars
Post by: Senkusha on August 13, 2004, 06:19:42 PM
Quote from: Mysterio on August 13, 2004, 06:02:32 PM
Okay, that's what I did, as well. I used that exact code to edit and replace as needed in BoardIndex.php, and those errors that I showed you is what came back.

So, I don't know what I did wrong.

Would it be possible to make the changes to you're own BoardIndex.php?

If you don't have one that's available, that's unedited and unchanged, want me to upload one that you can edit then re-upload yourself and then I can try that one out?

I'd be most appreciative if you could do that for me.

But I hear that you're busy at the moment, np... take you're time.

Thanks.

Hmm, can you provide a link so I can see what it is not doing?  It works fine on mine.  Also, that mod only displays the avatar for the current online users.  This is what you want, correct?  Or do you want it to display since midnight?
Title: Re: Who's online avatars
Post by: babylonking on August 13, 2004, 06:47:13 PM
Everything is fine here http://www.babylonking.net/include44.php

here is the code
// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName
LIMIT 5", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '<table border="0"><tr>';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<td></td><table>';
$link .= '
<td valign="middle" width="40"><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40"></td><td><table>';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<td align="center" valign="middle"><img src="' . $tmp['avatar'] . '" height="40"></td><td><table>';
else
$link .= '
<td align="center" valign="middle"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40"></td><td><table>';

// Some basic color coding...
if (!empty($row['onlineColor']))
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></font></td>
</tr>';
else
$link .= '
<tr>
<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a></font></td>
</tr>';
// Number of total posts
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Posts:&nbsp;' . $tmp['posts'] . '</font></td>
</tr>';
// Time the member last logged in
$link .= '<tr>
<td align="left" valign="top"><font size="1" face="Tahoma">Last On:&nbsp;' . date("H:i", $tmp['lastLogin']) . '</font></td>
</tr></table></td>
</tr></table>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table align="left" border="0">';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</table>';
}
Title: Re: Who's online avatars
Post by: Vinoth on August 14, 2004, 11:26:20 AM
ah great, i will add it tommorow.
Title: Re: Who's online avatars
Post by: Elisa on August 14, 2004, 02:40:08 PM
I have this error!!! Help!!!

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at D:\Inetpub\webs\lovemusicit\forum\recent.php:8) in D:\Inetpub\webs\lovemusicit\forum\SSI.php on line 93

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at D:\Inetpub\webs\lovemusicit\forum\recent.php:8) in D:\Inetpub\webs\lovemusicit\forum\SSI.php on line 93

Warning: Cannot modify header information - headers already sent by (output started at D:\Inetpub\webs\lovemusicit\forum\recent.php:8) in D:\Inetpub\webs\lovemusicit\forum\SSI.php on line 96
Recent Members


Title: Re: Who's online avatars
Post by: babylonking on August 14, 2004, 02:58:45 PM
I guess you should remove the session  ::)

Remove this in SSI.php
// Start the session... known to scramble SSI includes in cases...
if (!headers_sent())
loadSession();
else
{
if (!isset($_SESSION['rand_code']))
$_SESSION['rand_code'] = '';
$sc = &$_SESSION['rand_code'];
}
Title: Re: Who's online avatars
Post by: Elisa on August 14, 2004, 04:01:43 PM
Thanks thanks thanks!!!  Thanks many to all!!!
Title: Re: Who's online avatars
Post by: Elisa on August 15, 2004, 04:55:18 AM
I have a problem, this night I have changed the serveur and I have transferred the forum on serveur linux.  From that moment the hour is behind of 6 hours.

I have regulated the "Overall offset Time" and the timetable currently is corrected, but I must change the code in the SSI.php file why it does not have to calculate from midnight, but from midnight more six hours! How I make?

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
Title: Re: Who's online avatars
Post by: Senkusha on August 15, 2004, 07:03:24 AM
I'll have to add code that checks the overall time offset of the message board.
Title: Re: Who's online avatars
Post by: Elisa on August 16, 2004, 05:50:05 AM
You can make?  I do not know like saying to you thanks!   :) :)

You can also add IP address of the users beyond that the number post and the avatar?
Title: Re: Who's online avatars
Post by: Senkusha on August 16, 2004, 10:52:11 AM
For security reasons, I would highly recommend not displaying the IP address of any users.
Title: Re: Who's online avatars
Post by: Vinoth on August 16, 2004, 12:15:18 PM
Did u make users online in a day my friend senkushsa
Title: Re: Who's online avatars
Post by: NukeWorker.com on August 16, 2004, 05:04:14 PM
I couldn't get your code to work, some of the <tr>'s and <td>'s were wrong.  I played with it a little to fix that, and make it do what I wanted.  This is basically a SSI like who's online + avatars.  It works for me.  So I figured I'd share it with others. (By the way, how do we get this to work with logonline() ??

// Shows a list of recent users: YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $modSettings;

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mem.avatar,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;

while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}

$link = '';

// The user Avatar...
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);
if (mysql_num_rows ($AvatarReq) == 1)
$link .= '<br><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="24">&nbsp;';
$link .= '
';
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
$link .= '
<br><img src="' . $tmp['avatar'] . '" height="24">&nbsp;';
else
$link .= '
<br><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height=24>&nbsp;';

$link .= '
<a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';"><b><font size=2>' . $tmp['realName'] . '</a></b></font>, ';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'link' => $link,
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />
';

echo '<table border="0" style="border-collapse: collapse" cellpadding="0" cellspacing="0" width=140><tr><td>';
foreach ($return['users'] as $user)
echo $user['link'], !$user['is_last'] ? '' : '';
echo '</td></tr></table>';
}
Title: Re: Who's online avatars
Post by: Senkusha on August 16, 2004, 06:20:26 PM
Currently I haven't had time to add the logonline (guest counter)  I plan to add this functionality sometime this week.
Title: Re: Who's online avatars
Post by: Elisa on August 17, 2004, 11:55:42 AM
I have resolved the problem of the timetable.  I do not have more need of the modification.  For the IP, the administrators it can always see!  Therefore qual' it is the problem?
Title: Re: Who's online avatars
Post by: damo1065 on August 24, 2004, 10:53:28 PM
Quote from: Mysterio on August 13, 2004, 12:59:14 PM
Senkusha, I tried installing the 'Avatar Online' mod, but it brought back some errors:

QuoteNotice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 271
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 272
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 273
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 274
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 275
Notice: Undefined variable: tmp in /****/****/****/****/Sources/BoardIndex.php on line 279

And here is what's on lines 271-275:

         
Quote'id' => $tmp['ID_MEMBER'],
         'username' => $tmp['memberName'],
         'name' => $tmp['realName'],
         'group' => $tmp['ID_GROUP'],

And 279:

Quoteif ($tmp['onlineColor'] != '')

How do I fix that?

Thanks.

Are you still running Beta 5 - you need to upgrade to RC1.0

Senkusha - the uploaded avatars - how do you get them to show on your forums - btw fantastic mod....exactly what I was looking for, cheers :D

Title: Re: Who's online avatars
Post by: Elisa on August 25, 2004, 02:18:59 AM
You must excuse to me but I have one new demand.  If you can, helps me!  I would want, in the page of statistics of the forum, the number total of the users connected in one day.  How I can make?  Thanks!
Title: Re: Who's online avatars
Post by: Vinoth on August 25, 2004, 05:07:17 AM
senuska did u do  who is online in 24 hrs in a day!

if so pm me with the code,
Title: Re: Who's online avatars
Post by: Elisa on August 25, 2004, 05:29:31 AM
I have the page with the list of the users, with avatars, than but every day is cancelled.  I would want in the page of statistics, (where hour there are number users registered, the maximum number users connected...) the number total of the users connected to you during every day.  I would have to add one column to the table!  The code that I have used is what senuska it has written here.

http://www.simplemachines.org/community/index.php?topic=13676.msg127629#msg127629
Title: Re: Who's online avatars
Post by: FaSan on August 25, 2004, 08:52:39 AM
I've modification the code for the visualizzation all member online today on the index of the forum. In list, without Avatars :)

On BoardIndex.php


<Search>
// Load the users online right now.
</Search>

<Add Before>
// Load the users online today.

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));

// Load the users online for the past 24 hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.realName", __FILE__, __LINE__);

$today['users'] = array();
$today['num_users'] = 0;
$link = '';

while ($tmp = mysql_fetch_assoc($result))
{
$link .= '<a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a>, ';
$today['num_users']++;
}

mysql_free_result($result);

$context['user_today'] = $link;
$context['num_users_today'] = $today['num_users'];
</Add Before>



On BoardIndex.template.php


<Search>
// If they are logged in, but SP1 style information is off... show a personal message bar.
</Search>


<Add Before>
// "Users online Today"
echo '
<tr>
<td class="catbg" colspan="2">', $txt['158bis'], ' ( ', $context['num_users_today'], ' ', $context['num_users_today'] == 1 ? $txt['user'] : $txt['users'], ' )</td>
</tr><tr>
<td class="windowbg" width="20" valign="middle" align="center"><img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt['158bis'], '" border="0" /></td>
<td class="windowbg2" width="100%"><span class="smalltext">', $context['user_today'], '</span></td></tr>';
</Add Before>



On Modifications.english.php


<Search>
// Version: 1.0 RC1; Modifications
</Search>

<Add After>
$txt['158bis'] = 'OnLine Users Today';
</Add After>



On Modifications.italian.php


<Search>
// Version: 1.0 RC1; Modifications
</Search>

<Add After>
$txt['158bis'] = 'Utenti OnLine nella Giornata di Oggi';
</Add After>
Title: Re: Who's online avatars
Post by: Elisa on August 25, 2004, 12:15:58 PM
You are very very very fantastic!!!!!!!!!!
Title: Re: Who's online avatars
Post by: FaSan on August 25, 2004, 12:17:04 PM
Quote from: Elisa on August 25, 2004, 12:15:58 PM
I have this error:

Notice: Undefined index: 158bis in /web/htdocs/www.lovemusic.it/home/forum/Themes/viola theme/BoardIndex.template.php on line 387 ( 134 Utenti )



Add the lines on Modifications files ;)
Title: Re: Who's online avatars
Post by: Elisa on August 25, 2004, 12:24:00 PM
Fatto fatto fatto!!!!
Tutto a posto!!!!

Title: Re: Who's online avatars
Post by: FaSan on August 25, 2004, 12:28:48 PM
Quote from: Elisa on August 25, 2004, 12:24:00 PM
Fatto fatto fatto!!!!
Tutto a posto!!!!




Fine  ;)
Title: Re: Who's online avatars
Post by: Elisa on August 25, 2004, 12:31:51 PM
Beh veramente ci sarebbe un'altra cosa che vorrei fare!!!! Se vedi un pochino sopra ho fatto una richiesta che ora mi sembra un tantino supercomplicata!
Title: Re: Who's online avatars
Post by: FaSan on August 25, 2004, 12:33:07 PM
Quote from: Elisa on August 25, 2004, 12:31:51 PM
Beh veramente ci sarebbe un'altra cosa che vorrei fare!!!! Se vedi un pochino sopra ho fatto una richiesta che ora mi sembra un tantino supercomplicata!


You posting the details on Italian's Support Area ! ;)
Title: Re: Who's online avatars
Post by: Elisa on August 25, 2004, 12:41:01 PM
OK!
Title: Re: Who's online avatars
Post by: damo1065 on August 25, 2004, 12:47:39 PM
Great Stuff FaSan - I've changed my forum board to include the Users Online today as I had problems with the avatars not showing the uploaded avatars, and the way the were a vertical line.
Title: Re: Who's online avatars
Post by: TodaysXt on August 28, 2004, 02:31:40 PM
Senkusha,
Thanks so much for your Work.  I've wanted a mod like this and posted a request but didn't get much of a response, So I tried to do it myself  (example 1).  I haven't done much PHP so It was going slow.  I couldn't get my avatars right and needed help formating the time. 
The $context and array stuff is killing me.  I thing I've read too many different examples and missing some concepts like why '->' and not '=>' . 
I was about to give up when I saw your post. 
I tried the SSI function, works pretty good, but doesn't count the guest, it stays at zero?  I've also tried the boardindex.php code, but wasn't sure how to get it to sow up in the template so I just included it straight in the template and got it to work there as well, still showed zero guest though.

If I can make a request please, so I can stop banging my head.  Can you modify your code to end up like example 2 below? 
This was my query, Basically I wanted to end up like example 2.
I wanted it to show the last 10 recent members online.  (The Avatar, on/off line image, Name and lastlogin) going across the page.

   $rv = mysql_query("
      SELECT ID_MEMBER, memberName, realName, avatar, lastLogin
      FROM {$db_prefix}members
ORDER BY lastLogin DESC  LIMIT 10");
      while ($row = mysql_fetch_row($rv))

I will sart to try and work with your code to make this work but not having too much luck at the moment. 

Thanks for your time.
Xt.


Title: Re: Who's online avatars
Post by: Tercel on September 07, 2004, 05:10:51 PM
Hi Out there!
After trying to fix the original code (too much tds and trs - got a headache from that) i changed the code a little bit, and it works for me - may 4 u too ;D
It´s not professional, but ugly coding what I did, i know ;-)

Comments and critics are welcome!

Just add before "?>" at the end of SSI.php and call it from anywhere in your templates with ssi_whosRecent();

BTW: Thanks to Senkusha - should be a official Mod!

You might need this picture or similar for the changes - put it to your images-directory:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Ftercel.org%2Fbush%2Fguestlogo.gif&hash=9f385b00054f026d67582076d0b9df45a9d0231d)  <<< "save as" !

// Shows a list of recent users:  YY Guests, ZZ Users and then a list...
function ssi_whosRecent($output_method = 'echo')
{
global $scripturl, $db_prefix, $txt, $settings, $modSettings;

$midnight = ((date("U") - (date("H") * 3600)) - (date("i") * 60));
// ---------------------------------------------------------> ^ more than midnight (hours)?
// Load the users online for the past 24 (?) hours.
$result = db_query("
SELECT
mem.ID_MEMBER, mem.realName, mem.memberName, mem.ID_GROUP, mem.showOnline, mem.avatar, mem.lastLogin, mem.posts,
mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP OR (mem.ID_GROUP = 0 AND mg.ID_GROUP = mem.ID_POST_GROUP))
WHERE mem.lastLogin >= '$midnight'
ORDER BY mem.lastLogin DESC LIMIT 5", __FILE__, __LINE__);
//------------------------------> ^ More than the 5 last Users?
$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
echo '<table "width="80" bgcolor="#FFFFFF" border="0px">';
while ($tmp = mysql_fetch_assoc($result))
{
if (!isset($tmp['realName']))
{
$return['guests']++;
continue;
}
elseif (empty($tmp['showOnline']))
{
$return['hidden']++;
continue;
}



// The user Avatar...
$found = 0;
if ($tmp['avatar'] == '')
{
$AvatarReq = db_query ("SELECT * FROM {$db_prefix}attachments WHERE ID_MEMBER = '$tmp[ID_MEMBER]'", __FILE__, __LINE__);
$AvatarRes = mysql_fetch_assoc($AvatarReq);

if (mysql_num_rows ($AvatarReq) == 1)
{
$found = 1;
echo '<tr><td style="width: 45; valign: middle; align: center;"><img src="' . $scripturl . '?action=dlattach;id=' . $AvatarRes['ID_ATTACH'] . ';type=avatar" height="40" alt=""></td>';
}
}
elseif (strtoupper(substr($tmp['avatar'],0,7)) == 'HTTP://')
{
$found = 1;
echo '<tr><td style="width: 45; valign: middle; align: center;"><img src="' . $tmp['avatar'] . '" height="40" alt=""></td>';
}
if ((empty($tmp['avatar'])) && ($found == 0))
{
echo '<tr><td style="width: 45; valign: middle; align: center;"><img src="' . $settings['images_url'] . '/guestlogo.gif" alt="" border="0" align="middle" height="40"/></td>';
}
if ((!empty($tmp['avatar'])) && ($found != 1))
{
echo '<tr><td style="width: 45; valign: middle; align: center;"><img src="' . $modSettings['avatar_url'] . '/' . $tmp['avatar'] . '" height="40" alt=""></td>';
}

// Some basic color coding...what the hell is going on here???
if (!empty($row['onlineColor']))
echo '<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '" style="color: ' . $tmp['onlineColor'] . ';">' . $tmp['realName'] . '</a></font><br>';
else
echo '<td align="left" valign="top" nowrap><font size="1" face="Tahoma"><a href="' . $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'] . '">' . $tmp['realName'] . '</a><br>';
// Number of total posts
echo '<font size="1" face="Tahoma">Posts:&nbsp;' . $tmp['posts'] . '</font><br>';
// Time the member last logged in  !!! Just Comment // Out if User don´t like !!!
echo '<font size="1" face="Tahoma">On:' . date("d.m/H:i", $tmp['lastLogin']) . '</font>';


$return['users'][] = array(
'id' => $tmp['ID_MEMBER'],
'username' => $tmp['memberName'],
'name' => $tmp['realName'],
'group' => $tmp['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $tmp['ID_MEMBER'],
'online' => $tmp['showOnline'],
'is_last' => false
);
}
mysql_free_result($result);

$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if (!empty($return['users']))
$return['users'][count($return['users']) - 1]['is_last'] = true;

if ($output_method != 'echo')
return $return;
// -------------------- Comment 1st echo (not the table commands!!!) below out, if no User/Guest stuff needed -
echo '', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'], $return['hidden'] > 0 ? ' (' . $return['hidden'] . ' ' . $txt['hidden'] . ')' : '', '<br />';

echo '</td></tr></table>';
}
Title: Re: Who's online avatars
Post by: AxeCrazy on September 16, 2004, 08:22:01 AM
Quote from: Senkusha on August 11, 2004, 12:55:09 PM

      // The user Avatar...
      if ($row['avatar'] == '')
         $link = '&nbsp;<br>';
      elseif (strtoupper(substr($row['avatar'],0,7)) == 'HTTP://')
         $link = '<img src="' . $row['avatar'] . '" height="40"><br>';
      else
         $link = '<img src="' . $modSettings['avatar_url'] . '/' . $row['avatar'] . '" height="40"><br>';
Great one this ;D
just did a slight modification there in the boardindex.php.
I added the realname as ALT on each avatar of the user.

so
Quote
      // The user Avatar...
      if ($row['avatar'] == '')
         $link = $row['realName'] ;
      elseif (strtoupper(substr($row['avatar'],0,7)) == 'HTTP://')
         $link = '<img src="' . $row['avatar'] . '" height="40" alt="' .$row['realName'] .'" >';
      else
         $link = '<img src="' . $modSettings['avatar_url'] . '/' . $row['avatar'] . '" height="40" alt="' .$row['realName'] .'" >';
Title: Re: Online User's avatars rotation
Post by: SeaOfSin on May 31, 2005, 12:44:11 AM
Does this work with version 1.13, the board version not the ssi one?
Title: Re: Online User's avatars rotation
Post by: [Unknown] on May 31, 2005, 01:14:52 AM
There is no SMF 1.13.  What do you mean?

-[Unknown]
Title: Re: Online User's avatars rotation
Post by: SeaOfSin on May 31, 2005, 02:31:12 PM
Sorry, I meant 1.03.  I'm getting my numbers mixed up!

Sea Of Sin
Title: Re: Online User's avatars rotation
Post by: ormuz on June 16, 2010, 08:55:48 AM
Can someone update this?

Show the users online avatar by SSI?
Title: Re: Online User's avatars rotation
Post by: rlh2006 on June 29, 2010, 06:25:08 PM
I use my Urban Terror Avatars pack and a php rotate script so I have a nice dynamic avatar.