Online User's avatars rotation

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

Previous topic - Next topic

babylonking

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

Senkusha

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

Senkusha

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

Senkusha

Ok, I should have something to you in a few hours.  ;)
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

Vinoth

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!
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

Senkusha

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

Vinoth

Yes indeed!

can u do that , i will be very much thankfull to you!
Vinoth And Sachin ( SpecHackers Team )
The Best  Way to Help Poor Is not Becoming One Of Them.

Senkusha

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

babylonking

Quoteokay, check out the test page:  test SSI Recent and let me know what you think.

Very nice Senkusha i really like it  :)

Senkusha

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!

--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

babylonking

thanks Senkusha the code is working fine but how i limit the members to 5  active at least once during the past 24 hours.

Senkusha


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

babylonking

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

babylonking

Senkusha the uploaded avatars by members is not working  ::)

Senkusha

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?
--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 12, 2004, 06:26:14 PM
Senkusha the uploaded avatars by members is not working  ::)

What is it doing, and not doing?
--Senkusha
The Anime Brigade
Anime-style Role Playing Games and Discussion.
(SMF v. 2.1.4, PHP v. 8.0)

babylonking

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


Advertisement: