News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Online User's avatars rotation

Started by Fizzy, July 10, 2004, 03:39:46 AM

Previous topic - Next topic

Fizzy

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]
"Reality is merely an illusion, albeit a very persistent one." - A.E.


Vinoth

hmmmmm

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

so it is just waste of time for developers,
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

Fizzy

 ::) 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 :)
"Reality is merely an illusion, albeit a very persistent one." - A.E.


damo1065

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
Wy not visit my site... The Gaff'll be bored to be honest, unless you're from Cork in Ireland

emrys

Ok do you mean with thier names on the Board Index stats area?

Lord_Novice

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 ;)
Não subestime os Superaprendizes

Pocket Heroes recruta Superaprendizes

Senkusha

LOL, I just got done doing this on my site, 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.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

damo1065

Quote from: Senkusha on August 03, 2004, 06:49:23 AM
LOL, I just got done doing this on my site, 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!
Wy not visit my site... The Gaff'll be bored to be honest, unless you're from Cork in Ireland

Senkusha

Just let me know exactly (what to display, where, order, ...) what you need, and I'll see what I can do for you.  ;)
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

damo1065

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
Wy not visit my site... The Gaff'll be bored to be honest, unless you're from Cork in Ireland

babylonking

Hi Senkusha

Can you share the code here!

Thanks  :)

Senkusha

Sure!  Just to be specific, do you want the five most recent online members or just the five most recent members?
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

babylonking

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  :)

Vinoth

ah senuska

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

Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

Senkusha

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?
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Senkusha

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.
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

babylonking

Can this be done with SSI cuz i want to add this code in my main web site page?

Senkusha

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?
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

babylonking

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  :)

Senkusha

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)
...
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Advertisement: