collapse collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Who's Online

  • Dot Guests: 117
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM
  • phantomm: and from what I see only patch is broken, full install package is fine
    October 21, 2016, 03:44:44 PM

* Recent Posts

Where is the code for these elements, where are they stored? by danmsmith018f
[Yesterday at 04:23:44 PM]


Re: v 2.3.3 to v2.3.7 by ♦ Ninja ZX-10RR ♦
[December 11, 2018, 04:14:48 PM]


v 2.3.3 to v2.3.7 by rollingrock
[December 11, 2018, 09:36:20 AM]


[Block] Help with editing few lines on Simpleportal by Wallen
[December 09, 2018, 05:10:34 AM]


Re: LinkTree by Chen Zhen
[November 15, 2018, 02:24:51 PM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: [Block] Advanced Who's Online  (Read 71117 times)

0 Members and 1 Guest are viewing this topic.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #40 on: August 24, 2011, 07:33:01 PM »
Here:

Code: [Select]
<?php
/*
Block: Who's Online with Avatar
Author: Blue @ Simple Portal.net
Version: 1.2gold
*/

/* SETUP HERE */
$mode '1'; // 1 = SimplePortal Block with Avatars | 2 = Facebook like Block | 3 = SMF Forum like Block 
// 4 = Online Today -> SimplePortal Block like | 5 = Online Today -> SMF Forum like Block

$scrollheight '100px';
$width '35px'// Avatar Width
$height '35px'// Avatar Height
$default_avatar 'URL HERE'//URL To the default avatar

$show_guests true// Show guests count
$show_spiders false// Show spiders count
$show_hidden true// Show hidden count
$show_users true// Show users count
$show_visible_today true// Show visible users of today (ONLY IN MODE 4 AND 5)
$show_hidden_today true// Show hidden users of today (ONLY IN MODE 4 AND 5)


$show_guests_users false// Show Guests and Users combined (SUM of the two)
$fake_online 1//Increase Guest number by multiplying for the value of fake_online

/**********************************************************************************/

// CODE FROM NOW ON! STOP HERE!
global $smcFunc$scripturl$sourcedir$modSettings$txt$settings$context;


$members_result $smcFunc['db_query']('''
SELECT l.id_member, m.member_name, m.show_online, m.avatar, g.online_color, g.id_group, g.group_name
FROM {db_prefix}log_online AS l
LEFT JOIN {db_prefix}members AS m ON (m.id_member = l.id_member)
LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN m.id_group = 0 THEN m.id_post_group ELSE m.id_group END)
WHERE l.id_member > 0'
);
$members = array();
while ($row_members $smcFunc['db_fetch_assoc']($members_result))
{

      global 
$memberContext;
      
loadMemberData($row_members['id_member']);
      
loadMemberContext($row_members['id_member']);


   $members[] = array(
  'id' => $row_members['id_member'],
  'username' => $row_members['member_name'],
  'profile' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['member_name'] . '</a>',
  'link' => $scripturl '?action=profile;u=' $row_members['id_member'],
  'avatar' => $row_members['avatar'] == '' $memberContext[$row_members['id_member']]['avatar']['href'] : (stristr($row_members['avatar'], 'http://') ? $row_members['avatar'] : $modSettings['avatar_url'] . '/' $row_members['avatar']),
  'hidden' => empty($row_members['show_online'])
   );
}
$smcFunc['db_free_result']($members_result);

$stats ssi_whosOnline('array');

// Output here we go!

if ($mode == '1') {

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot'), ' Online: '$combined  .'<br />';
} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'<br />';
}

if ($show_hidden)
echo sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'] .'<br />';

if ($show_spiders && allowedTo('admin_forum'))
echo sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'] .'<br />';

echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' ''$txt['online_users'], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' ''':
<br />'
;

echo 
'<div style="overflow: auto; height: ' $scrollheight ';">';

foreach ($members as $member) {
if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $member['avatar'] . '" width="' $width '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $default_avatar .'" width="' $width '" alt="" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
}
}
echo '</div>';

} elseif (
$mode == '2') {
echo 
'<div style="overflow: auto; height: ' $scrollheight ';">';

foreach ($members as $member) {
echo '
<a href="' 
$member['link'] . '">';

if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $member['avatar'] . '" width="' $width '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px;  margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $default_avatar .'" width="' $width '" alt="'$txt['default_avatar'], '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>';
}
echo '</div><hr />';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot');

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '<a href="' $scripturl '?action=who">';

echo ' Online: ';

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '</a>';

echo $combined;

} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'&nbsp;|&nbsp;';

if ($show_users)
echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' '''Users'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>:&nbsp;' $stats['num_users_online'] : '';
}

if ($show_hidden)
echo '<br />' sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'];

if ($show_spiders && allowedTo('admin_forum'))
echo '&nbsp;|&nbsp;' sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'];

} elseif (
$mode == '3') {
echo '<div>';

echo '<a style="font-size:1.1em;" href="' $scripturl '?action=who">';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo $combined  .' Online';
} else {
if ($show_guests)
echo $stats['num_guests'] * $fake_online ' ' $txt['guests'] . ', ';

if ($show_users)
echo $stats['num_users_online'] . ' ' $txt['users'];
}
if ($show_hidden)
echo ' (' $stats['num_users_hidden'] . ' ' $txt['hidden'] . ')';

if ($show_spiders && allowedTo('admin_forum'))
echo ' (' $stats['num_spiders'] . ' ' $txt['spiders'] . ')';

echo '</a><br /><span class="last smalltext">Users active in past minutes:</span><br />';

foreach ($members as $member) {
if ($stats['num_users_online'] == '1')
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a> ';
else
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a>, ';
}

echo '<hr /><span class="last smalltext">
'
$txt['most_online_today'], ': <strong>'comma_format($modSettings['mostOnlineToday']), '</strong>.
'
$txt['most_online_ever'], ': 'comma_format($modSettings['mostOnline']), ' ('timeformat($modSettings['mostDate']), ')
</span>'
;

echo '</div>';


} elseif (
$mode == '4') {

echo '<div style="overflow: auto; height: ' $scrollheight ';">';

$context += getUsersOnlineTodayStats();

echo sp_embed_image('dot'), ' '$txt['uot_total'], ': '$context['num_users_online_today'], '<br />';

if ($show_visible_today)
echo sp_embed_image('dot'), ' '$txt['uot_visible'], ': '$context['num_users_online_today'] - $context['num_users_hidden_today'] .'<br />';

if ($show_hidden_today)
echo sp_embed_image('dot'), ' '$txt['uot_hidden'], ': '$context['num_users_hidden_today'] .'<br />';


echo sp_embed_image('dot') . ' ' $txt['users'] . ':<br />

<ul class="sp_list"><li class="sp_list_indent">'
;

echo sp_embed_image('user') . ' ' implode('</li><li class="sp_list_indent">' sp_embed_image('user') . ' ' $context['list_users_online_today']);

echo '</ul></div>';

} else {

$context += getUsersOnlineTodayStats();

echo '<span style="font-size:1.1em;">' $context['num_users_online_today'], ' ' $txt['uot_total'] , ' ' $txt['users'] . '</span>';

if ($show_visible_today OR $show_hidden_today)
echo ' (';

if ($show_visible_today)
echo $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']);

if ($show_visible_today AND $show_hidden_today)
echo ', ';

if ($show_hidden_today)
echo $txt['uot_hidden'], ': '$context['num_users_hidden_today'];

if ($show_visible_today OR $show_hidden_today)
echo ')';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']) && $context['viewing_allowed'])
{
echo
'<br />'implode(', '$context['list_users_online_today']);
}
}
?>
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline RaulVK

  • Semi Newbie
  • *
  • Posts: 35
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Advanced Who's Online
« Reply #41 on: August 25, 2011, 04:50:58 AM »
Instead height: ' . $scrollheight . ',  replace by max-height: ' . $scrollheight . '  Right?


Translated by Google



Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #42 on: August 25, 2011, 11:20:40 PM »
Yes, you can do that ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

wiecher

  • Guest
Re: [Block] Advanced Who's Online
« Reply #43 on: August 29, 2011, 06:15:30 PM »
Works perfect.
Is it possible to hide usernames for guest ?

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #44 on: August 29, 2011, 06:20:55 PM »
You want guests to see the stats but not the usernames?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

wiecher

  • Guest
Re: [Block] Advanced Who's Online
« Reply #45 on: August 29, 2011, 06:21:57 PM »
You want guests to see the stats but not the usernames?
Yes please  ;D :D ;D

I have this block.

Code: [Select]
<?php
/*
Block: Who's Online with Avatar
Author: Blue @ Simple Portal.net
Version: 1.0gold
*/

/* SETUP HERE */
$mode '1'// 1 = SimplePortal Block with Avatars | 2 = Facebook like Block | 3 = SMF Forum like Block

$height '20px'// Avatar Height
$default_avatar 'URL HERE'//URL To the default avatar

$show_guests true// Show guests count
$show_spiders false// Show spiders count
$show_hidden false// Show hidden count
$show_users true// Show users count

$show_guests_users false// Show Guests and Users combined (SUM of the two)
$fake_online 17//Increase Guest number by multiplying for the value of fake_online

/**********************************************************************************/

// CODE FROM NOW ON! STOP HERE!
global $smcFunc$scripturl$sourcedir$modSettings$txt$settings$context;


$members_result $smcFunc['db_query']('''
SELECT l.id_member, m.member_name, m.show_online, m.avatar, g.online_color, g.id_group, g.group_name
FROM {db_prefix}log_online AS l
LEFT JOIN {db_prefix}members AS m ON (m.id_member = l.id_member)
LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN m.id_group = 0 THEN m.id_post_group ELSE m.id_group END)
WHERE l.id_member > 0'
);
$members = array();
while ($row_members $smcFunc['db_fetch_assoc']($members_result))
{

      global 
$memberContext;
      
loadMemberData($row_members['id_member']);
      
loadMemberContext($row_members['id_member']);


   $members[] = array(
  'id' => $row_members['id_member'],
  'username' => $row_members['member_name'],
  'profile' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['member_name'] . '</a>',
  'link' => $scripturl '?action=profile;u=' $row_members['id_member'],
  'avatar' => $memberContext[$row_members['id_member']]['avatar']['href'],
  'hidden' => empty($row_members['show_online'])
   );
}
$smcFunc['db_free_result']($members_result);

$stats ssi_whosOnline('array');

// Output here we go!

if ($mode == '1') {

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot'), ' Online: '$combined  .'<br />';
} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'<br />';
}

if ($show_hidden)
echo sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'] .'<br />';

if ($show_spiders && allowedTo('admin_forum'))
echo sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'] .'<br />';

echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' ''$txt['online_users'], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' ''':
<br /><div>'
;

foreach ($members as $member) {
if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $member['avatar'] . '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $default_avatar .'" alt="" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
}
}
echo '</div>';

} elseif (
$mode == '2') {
echo '<div>';

foreach ($members as $member) {
echo '
<a href="' 
$member['link'] . '">';

if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $member['avatar'] . '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px;  margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $default_avatar .'" alt="'$txt['default_avatar'], '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>';
}
echo '</div><hr />';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot');

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '<a href="' $scripturl '?action=who">';

echo ' Online: ';

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '</a>';

echo $combined;

} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'&nbsp;|&nbsp;';

if ($show_users)
echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' '''Users'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>:&nbsp;' $stats['num_users_online'] : '';
}

if ($show_hidden)
echo '<br />' sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'];

if ($show_spiders && allowedTo('admin_forum'))
echo '&nbsp;|&nbsp;' sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'];

} else {
echo '<div>';

echo '<a style="font-size:1.1em;" href="' $scripturl '?action=who">';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo $combined  .' Online';
} else {
if ($show_guests)
echo $stats['num_guests'] * $fake_online ' ' $txt['guests'] . ', ';

if ($show_users)
echo $stats['num_users_online'] . ' ' $txt['users'];
}
if ($show_hidden)
echo ' (' $stats['num_users_hidden'] . ' ' $txt['hidden'] . ')';

if ($show_spiders && allowedTo('admin_forum'))
echo ' (' $stats['num_spiders'] . ' ' $txt['spiders'] . ')';

echo '</a><br /><span class="last smalltext">Users active in past minutes:</span><br />';

foreach ($members as $member) {
if ($stats['num_users_online'] == '1')
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a> ';
else
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a>, ';
}

echo '<hr /><span class="last smalltext">
'
$txt['most_online_today'], ': <strong>'comma_format($modSettings['mostOnlineToday']), '</strong>.
'
$txt['most_online_ever'], ': 'comma_format($modSettings['mostOnline']), ' ('timeformat($modSettings['mostDate']), ')
</span>'
;

echo '</div>';
}
?>
« Last Edit: August 29, 2011, 06:24:59 PM by wiecher »

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Who's Online
« Reply #46 on: August 30, 2011, 12:17:04 PM »
@Blue,

since i'm using your block-code i have my error log full with "undefined index: default_avatar"...

it is a language problem?

Offline Sapinho®

  • Full Member
  • ***
  • Posts: 168
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #47 on: August 30, 2011, 02:05:43 PM »
not are, is a error of finger, search in the code of @blue this

Code: [Select]
alt="', $txt['default_avatar'], '"

and deleted, this is the problem,

this not make problem because the property is forward
Code: [Select]
title="' . $member['username'] . '" alt="' . $member['username'] . '"

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #48 on: September 01, 2011, 03:06:48 AM »
Blue,

Can you do a code for the online's without the avatar and using display name's? If the member does have a display to show. If not it's will show their username.

When I use this code it's show up my user name not my display name.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #49 on: September 01, 2011, 05:38:23 PM »
Yes please  ;D :D ;D

Try this:
Code: [Select]
<?php
/*
Block: Who's Online with Avatar
Author: Blue @ Simple Portal.net
Version: 1.0gold
*/

/* SETUP HERE */
$mode '1'// 1 = SimplePortal Block with Avatars | 2 = Facebook like Block | 3 = SMF Forum like Block

$height '20px'// Avatar Height
$default_avatar 'URL HERE'//URL To the default avatar

$show_guests true// Show guests count
$show_spiders false// Show spiders count
$show_hidden false// Show hidden count
$show_users true// Show users count

$show_guests_users false// Show Guests and Users combined (SUM of the two)
$fake_online 17//Increase Guest number by multiplying for the value of fake_online

/**********************************************************************************/

// CODE FROM NOW ON! STOP HERE!
global $smcFunc$scripturl$sourcedir$modSettings$txt$settings$context;


$members_result $smcFunc['db_query']('''
SELECT l.id_member, m.member_name, m.show_online, m.avatar, g.online_color, g.id_group, g.group_name
FROM {db_prefix}log_online AS l
LEFT JOIN {db_prefix}members AS m ON (m.id_member = l.id_member)
LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN m.id_group = 0 THEN m.id_post_group ELSE m.id_group END)
WHERE l.id_member > 0'
);
$members = array();
while ($row_members $smcFunc['db_fetch_assoc']($members_result))
{

      global 
$memberContext;
      
loadMemberData($row_members['id_member']);
      
loadMemberContext($row_members['id_member']);


   $members[] = array(
  'id' => $row_members['id_member'],
  'username' => $row_members['member_name'],
  'profile' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['member_name'] . '</a>',
  'link' => $scripturl '?action=profile;u=' $row_members['id_member'],
  'avatar' => $memberContext[$row_members['id_member']]['avatar']['href'],
  'hidden' => empty($row_members['show_online'])
   );
}
$smcFunc['db_free_result']($members_result);

$stats ssi_whosOnline('array');

// Output here we go!

if ($mode == '1') {

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot'), ' Online: '$combined  .'<br />';
} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'<br />';
}

if ($show_hidden)
echo sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'] .'<br />';

if ($show_spiders && allowedTo('admin_forum'))
echo sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'] .'<br />';

echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' ''$txt['online_users'], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' ''':
<br /><div>'
;

if (
$context['user']['is_guest'])
{
foreach ($members as $member) {
if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $member['avatar'] . '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $default_avatar .'" alt="" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
}
}
}

echo '</div>';

} elseif (
$mode == '2') {
echo '<div>';

if (
$context['user']['is_guest'])
{

foreach ($members as $member) {
echo '
<a href="' 
$member['link'] . '">';

if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $member['avatar'] . '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px;  margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $default_avatar .'" alt="'$txt['default_avatar'], '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>';
}
}

echo '</div><hr />';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot');

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '<a href="' $scripturl '?action=who">';

echo ' Online: ';

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '</a>';

echo $combined;

} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'&nbsp;|&nbsp;';

if ($show_users)
echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' '''Users'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>:&nbsp;' $stats['num_users_online'] : '';
}

if ($show_hidden)
echo '<br />' sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'];

if ($show_spiders && allowedTo('admin_forum'))
echo '&nbsp;|&nbsp;' sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'];

} else {
echo '<div>';

echo '<a style="font-size:1.1em;" href="' $scripturl '?action=who">';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo $combined  .' Online';
} else {
if ($show_guests)
echo $stats['num_guests'] * $fake_online ' ' $txt['guests'] . ', ';

if ($show_users)
echo $stats['num_users_online'] . ' ' $txt['users'];
}
if ($show_hidden)
echo ' (' $stats['num_users_hidden'] . ' ' $txt['hidden'] . ')';

if ($show_spiders && allowedTo('admin_forum'))
echo ' (' $stats['num_spiders'] . ' ' $txt['spiders'] . ')';

echo '</a><br /><span class="last smalltext">Users active in past minutes:</span><br />';

foreach ($members as $member) {
if ($stats['num_users_online'] == '1')
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a> ';
else
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a>, ';
}

echo '<hr /><span class="last smalltext">
'
$txt['most_online_today'], ': <strong>'comma_format($modSettings['mostOnlineToday']), '</strong>.
'
$txt['most_online_ever'], ': 'comma_format($modSettings['mostOnline']), ' ('timeformat($modSettings['mostDate']), ')
</span>'
;

echo '</div>';
}
?>

Blue,

Can you do a code for the online's without the avatar and using display name's? If the member does have a display to show. If not it's will show their username.

When I use this code it's show up my user name not my display name.

Do you want me to modify the MODE 1 to show dusplay name instead of username? :)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

wiecher

  • Guest
Re: [Block] Advanced Who's Online
« Reply #50 on: September 01, 2011, 05:43:37 PM »
Thnx Blue that is what i like  ;D
But i would onely show guest and no members.
« Last Edit: September 01, 2011, 05:48:22 PM by wiecher »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #51 on: September 01, 2011, 05:59:11 PM »
Did not understand you. Can you explain better?
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

wiecher

  • Guest
Re: [Block] Advanced Who's Online
« Reply #52 on: September 01, 2011, 06:03:31 PM »
Did not understand you. Can you explain better?
Okay Bleu i see this.
But i want onely see gasten online,

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #53 on: September 01, 2011, 08:28:46 PM »
Like this?

Code: [Select]
<?php
/*
Block: Who's Online with Avatar
Author: Blue @ Simple Portal.net
Version: 1.0gold
*/

/* SETUP HERE */
$mode '1'// 1 = SimplePortal Block with Avatars | 2 = Facebook like Block | 3 = SMF Forum like Block

$height '20px'// Avatar Height
$default_avatar 'URL HERE'//URL To the default avatar

$show_guests true// Show guests count
$show_spiders false// Show spiders count
$show_hidden false// Show hidden count
$show_users true// Show users count

$show_guests_users false// Show Guests and Users combined (SUM of the two)
$fake_online 17//Increase Guest number by multiplying for the value of fake_online

/**********************************************************************************/

// CODE FROM NOW ON! STOP HERE!
global $smcFunc$scripturl$sourcedir$modSettings$txt$settings$context;


$members_result $smcFunc['db_query']('''
SELECT l.id_member, m.member_name, m.show_online, m.avatar, g.online_color, g.id_group, g.group_name
FROM {db_prefix}log_online AS l
LEFT JOIN {db_prefix}members AS m ON (m.id_member = l.id_member)
LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN m.id_group = 0 THEN m.id_post_group ELSE m.id_group END)
WHERE l.id_member > 0'
);
$members = array();
while ($row_members $smcFunc['db_fetch_assoc']($members_result))
{

      global 
$memberContext;
      
loadMemberData($row_members['id_member']);
      
loadMemberContext($row_members['id_member']);


   $members[] = array(
  'id' => $row_members['id_member'],
  'username' => $row_members['member_name'],
  'profile' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['member_name'] . '</a>',
  'link' => $scripturl '?action=profile;u=' $row_members['id_member'],
  'avatar' => $memberContext[$row_members['id_member']]['avatar']['href'],
  'hidden' => empty($row_members['show_online'])
   );
}
$smcFunc['db_free_result']($members_result);

$stats ssi_whosOnline('array');

// Output here we go!

if ($mode == '1') {

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot'), ' Online: '$combined  .'<br />';
} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'<br />';
}

if ($show_hidden)
echo sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'] .'<br />';

if ($show_spiders && allowedTo('admin_forum'))
echo sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'] .'<br />';

if (
$context['user']['is_guest'])
{

echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' ''$txt['online_users'], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' ''':
<br /><div>'
;

foreach ($members as $member) {
if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $member['avatar'] . '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $default_avatar .'" alt="" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
}
}
}

echo '</div>';

} elseif (
$mode == '2') {
echo '<div>';

if (
$context['user']['is_guest'])
{

foreach ($members as $member) {
echo '
<a href="' 
$member['link'] . '">';

if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $member['avatar'] . '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px;  margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $default_avatar .'" alt="'$txt['default_avatar'], '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>';
}
}

echo '</div><hr />';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot');

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '<a href="' $scripturl '?action=who">';

echo ' Online: ';

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '</a>';

echo $combined;

} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'&nbsp;|&nbsp;';

if ($show_users)
echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' '''Users'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>:&nbsp;' $stats['num_users_online'] : '';
}

if ($show_hidden)
echo '<br />' sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'];

if ($show_spiders && allowedTo('admin_forum'))
echo '&nbsp;|&nbsp;' sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'];

} else {
echo '<div>';

echo '<a style="font-size:1.1em;" href="' $scripturl '?action=who">';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo $combined  .' Online';
} else {
if ($show_guests)
echo $stats['num_guests'] * $fake_online ' ' $txt['guests'] . ', ';

if ($show_users)
echo $stats['num_users_online'] . ' ' $txt['users'];
}
if ($show_hidden)
echo ' (' $stats['num_users_hidden'] . ' ' $txt['hidden'] . ')';

if ($show_spiders && allowedTo('admin_forum'))
echo ' (' $stats['num_spiders'] . ' ' $txt['spiders'] . ')';

echo '</a><br /><span class="last smalltext">Users active in past minutes:</span><br />';

foreach ($members as $member) {
if ($stats['num_users_online'] == '1')
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a> ';
else
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a>, ';
}

echo '<hr /><span class="last smalltext">
'
$txt['most_online_today'], ': <strong>'comma_format($modSettings['mostOnlineToday']), '</strong>.
'
$txt['most_online_ever'], ': 'comma_format($modSettings['mostOnline']), ' ('timeformat($modSettings['mostDate']), ')
</span>'
;

echo '</div>';
}
?>
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

wiecher

  • Guest
Re: [Block] Advanced Who's Online
« Reply #54 on: September 02, 2011, 05:12:36 AM »
No not yet Blue.
See my attachment please.

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #55 on: September 02, 2011, 10:35:47 PM »
Blue,

Can you do a code for the online's without the avatar and using display name's? If the member does have a display to show. If not it's will show their username.

When I use this code it's show up my user name not my display name.

Do you want me to modify the MODE 1 to show dusplay name instead of username? :)

Yes, Please if you can. If the member's don't have a display name it's will show their username's. Can you do one without any photo's in the code?

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #56 on: September 02, 2011, 10:45:43 PM »
Here I was trying to say.  I mean if the person only using their display using if they don't it can have the username.  I was searching for a code like the screen shoot I took. And I would like to have it like that. But no avater to show at all.

« Last Edit: September 02, 2011, 10:48:48 PM by Shadow Queen »

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #57 on: September 03, 2011, 04:08:08 PM »
Ok, I'm gonna do it  :D
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Shadow Queen

  • Jr. Member
  • **
  • Posts: 62
  • Gender: Female
    • My Kingdom
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #58 on: September 03, 2011, 04:22:53 PM »
Thank you Blue! :)

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #59 on: September 05, 2011, 11:51:05 AM »
No not yet Blue.

Here it is:
Code: [Select]
<?php
/*
Block: Who's Online with Avatar
Author: Blue @ Simple Portal.net
Version: 1.2gold
*/

/* SETUP HERE */
$mode '1'; // 1 = SimplePortal Block with Avatars | 2 = Facebook like Block | 3 = SMF Forum like Block 
// 4 = Online Today -> SimplePortal Block like | 5 = Online Today -> SMF Forum like Block

$scrollheight '100px';
$width '35px'// Avatar Width
$height '35px'// Avatar Height
$default_avatar 'URL HERE'//URL To the default avatar

$show_guests true// Show guests count
$show_spiders false// Show spiders count
$show_hidden true// Show hidden count
$show_users true// Show users count
$show_visible_today true// Show visible users of today (ONLY IN MODE 4 AND 5)
$show_hidden_today true// Show hidden users of today (ONLY IN MODE 4 AND 5)


$show_guests_users false// Show Guests and Users combined (SUM of the two)
$fake_online 1//Increase Guest number by multiplying for the value of fake_online

/**********************************************************************************/

// CODE FROM NOW ON! STOP HERE!
global $smcFunc$scripturl$sourcedir$modSettings$txt$settings$context;


$members_result $smcFunc['db_query']('''
SELECT l.id_member, m.member_name, m.show_online, m.avatar, g.online_color, g.id_group, g.group_name
FROM {db_prefix}log_online AS l
LEFT JOIN {db_prefix}members AS m ON (m.id_member = l.id_member)
LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN m.id_group = 0 THEN m.id_post_group ELSE m.id_group END)
WHERE l.id_member > 0'
);
$members = array();
while ($row_members $smcFunc['db_fetch_assoc']($members_result))
{

      global 
$memberContext;
      
loadMemberData($row_members['id_member']);
      
loadMemberContext($row_members['id_member']);


   $members[] = array(
  'id' => $row_members['id_member'],
  'username' => $row_members['member_name'],
  'profile' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['member_name'] . '</a>',
  'link' => $scripturl '?action=profile;u=' $row_members['id_member'],
  'avatar' => $row_members['avatar'] == '' $memberContext[$row_members['id_member']]['avatar']['href'] : (stristr($row_members['avatar'], 'http://') ? $row_members['avatar'] : $modSettings['avatar_url'] . '/' $row_members['avatar']),
  'hidden' => empty($row_members['show_online'])
   );
}
$smcFunc['db_free_result']($members_result);

$stats ssi_whosOnline('array');

// Output here we go!

if ($mode == '1') {

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot'), ' Online: '$combined  .'<br />';
} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'<br />';
}

if (
$context['user']['is_logged'])
{

if ($show_hidden)
echo sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'] .'<br />';

if ($show_spiders && allowedTo('admin_forum'))
echo sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'] .'<br />';

echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' ''$txt['online_users'], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' ''':
<br /><div>'
;

foreach ($members as $member) {
if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $member['avatar'] . '" width="' $width '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px; margin-bottom:2px;" src="' $default_avatar .'" width="' $width '" alt="" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" /> ' $member['profile'] . '<br />';
}
}
echo '</div>';
}

} elseif (
$mode == '2') {
echo '<div>';

foreach ($members as $member) {
echo '
<a href="' 
$member['link'] . '">';

if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $member['avatar'] . '" width="' $width '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px;  margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $default_avatar .'" width="' $width '" alt="'$txt['default_avatar'], '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>';
}
echo '</div><hr />';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot');

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '<a href="' $scripturl '?action=who">';

echo ' Online: ';

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '</a>';

echo $combined;

} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'&nbsp;|&nbsp;';

if ($show_users)
echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' '''Users'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>:&nbsp;' $stats['num_users_online'] : '';
}

if ($show_hidden)
echo '<br />' sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'];

if ($show_spiders && allowedTo('admin_forum'))
echo '&nbsp;|&nbsp;' sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'];

} elseif (
$mode == '3') {
echo '<div>';

echo '<a style="font-size:1.1em;" href="' $scripturl '?action=who">';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo $combined  .' Online';
} else {
if ($show_guests)
echo $stats['num_guests'] * $fake_online ' ' $txt['guests'] . ', ';

if ($show_users)
echo $stats['num_users_online'] . ' ' $txt['users'];
}
if ($show_hidden)
echo ' (' $stats['num_users_hidden'] . ' ' $txt['hidden'] . ')';

if ($show_spiders && allowedTo('admin_forum'))
echo ' (' $stats['num_spiders'] . ' ' $txt['spiders'] . ')';

echo '</a><br /><span class="last smalltext">Users active in past minutes:</span><br />';

foreach ($members as $member) {
if ($stats['num_users_online'] == '1')
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a> ';
else
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a>, ';
}

echo '<hr /><span class="last smalltext">
'
$txt['most_online_today'], ': <strong>'comma_format($modSettings['mostOnlineToday']), '</strong>.
'
$txt['most_online_ever'], ': 'comma_format($modSettings['mostOnline']), ' ('timeformat($modSettings['mostDate']), ')
</span>'
;

echo '</div>';


} elseif (
$mode == '4') {

echo '<div style="overflow: auto; height: ' $scrollheight ';">';

$context += getUsersOnlineTodayStats();

echo sp_embed_image('dot'), ' '$txt['uot_total'], ': '$context['num_users_online_today'], '<br />';

if ($show_visible_today)
echo sp_embed_image('dot'), ' '$txt['uot_visible'], ': '$context['num_users_online_today'] - $context['num_users_hidden_today'] .'<br />';

if ($show_hidden_today)
echo sp_embed_image('dot'), ' '$txt['uot_hidden'], ': '$context['num_users_hidden_today'] .'<br />';


echo sp_embed_image('dot') . ' ' $txt['users'] . ':<br />

<ul class="sp_list"><li class="sp_list_indent">'
;

echo sp_embed_image('user') . ' ' implode('</li><li class="sp_list_indent">' sp_embed_image('user') . ' ' $context['list_users_online_today']);

echo '</ul></div>';

} else {

$context += getUsersOnlineTodayStats();

echo '<span style="font-size:1.1em;">' $context['num_users_online_today'], ' ' $txt['uot_total'] , ' ' $txt['users'] . '</span>';

if ($show_visible_today OR $show_hidden_today)
echo ' (';

if ($show_visible_today)
echo $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']);

if ($show_visible_today AND $show_hidden_today)
echo ', ';

if ($show_hidden_today)
echo $txt['uot_hidden'], ': '$context['num_users_hidden_today'];

if ($show_visible_today OR $show_hidden_today)
echo ')';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']) && $context['viewing_allowed'])
{
echo
'<br />'implode(', '$context['list_users_online_today']);
}
}
?>

Here I was trying to say.  I mean if the person only using their display using if they don't it can have the username.  I was searching for a code like the screen shoot I took. And I would like to have it like that. But no avater to show at all.

Here it is Shadow Queen:
Code: [Select]
<?php
/*
Block: Who's Online with Avatar
Author: Blue @ Simple Portal.net
Version: 1.2gold
*/

/* SETUP HERE */
$mode '1'; // 1 = SimplePortal Block with Avatars | 2 = Facebook like Block | 3 = SMF Forum like Block 
// 4 = Online Today -> SimplePortal Block like | 5 = Online Today -> SMF Forum like Block

$scrollheight '100px';
$width '35px'// Avatar Width
$height '35px'// Avatar Height
$default_avatar 'URL HERE'//URL To the default avatar

$show_guests true// Show guests count
$show_spiders false// Show spiders count
$show_hidden true// Show hidden count
$show_users true// Show users count
$show_visible_today true// Show visible users of today (ONLY IN MODE 4 AND 5)
$show_hidden_today true// Show hidden users of today (ONLY IN MODE 4 AND 5)


$show_guests_users false// Show Guests and Users combined (SUM of the two)
$fake_online 1//Increase Guest number by multiplying for the value of fake_online

/**********************************************************************************/

// CODE FROM NOW ON! STOP HERE!
global $smcFunc$scripturl$sourcedir$modSettings$txt$settings$context;


$members_result $smcFunc['db_query']('''
SELECT l.id_member, m.member_name, m.real_name, m.show_online, m.avatar, g.online_color, g.id_group, g.group_name
FROM {db_prefix}log_online AS l
LEFT JOIN {db_prefix}members AS m ON (m.id_member = l.id_member)
LEFT JOIN {db_prefix}membergroups AS g ON (g.id_group = CASE WHEN m.id_group = 0 THEN m.id_post_group ELSE m.id_group END)
WHERE l.id_member > 0'
);
$members = array();
while ($row_members $smcFunc['db_fetch_assoc']($members_result))
{

      global 
$memberContext;
      
loadMemberData($row_members['id_member']);
      
loadMemberContext($row_members['id_member']);


   $members[] = array(
  'id' => $row_members['id_member'],
  'username' => $row_members['member_name'],
  'realname' => $row_members['real_name'],
  'profile' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['member_name'] . '</a>',   
  'profile_real' => '<a style="color: ' $row_members['online_color'] . ';" title="' $row_members['group_name'] . '" href="' $scripturl '?action=profile;u=' $row_members['id_member'] . '">' $row_members['real_name'] . '</a>',
  'link' => $scripturl '?action=profile;u=' $row_members['id_member'],
  'avatar' => $row_members['avatar'] == '' $memberContext[$row_members['id_member']]['avatar']['href'] : (stristr($row_members['avatar'], 'http://') ? $row_members['avatar'] : $modSettings['avatar_url'] . '/' $row_members['avatar']),
  'hidden' => empty($row_members['show_online'])
   );
}
$smcFunc['db_free_result']($members_result);

$stats ssi_whosOnline('array');

// Output here we go!

if ($mode == '1') {

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot'), ' Online: '$combined  .'<br />';
} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'<br />';
}

if ($show_hidden)
echo sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'] .'<br />';

if ($show_spiders && allowedTo('admin_forum'))
echo sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'] .'<br />';

echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' ''$txt['online_users'], allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>' ''':
<br /><div>'
;

foreach ($members as $member) {
if ($member['username'] == $member['realname']){
echo '&nbsp;&nbsp;' sp_embed_image('user') . '&nbsp;' $member['profile'] . '<br />';
} else {
echo '&nbsp;&nbsp;' sp_embed_image('user') . '&nbsp;' $member['profile_real'] . '<br />';
}
}
echo '</div>';

} elseif (
$mode == '2') {
echo '<div>';

foreach ($members as $member) {
echo '
<a href="' 
$member['link'] . '">';

if (!empty($member['avatar'])){
echo '<img style="border: 1px solid silver; padding: 1px; margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $member['avatar'] . '" width="' $width '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
} else {
echo '<img style="border: 1px solid silver; padding: 1px;  margin-top:1px;margin-left:1px;margin-bottom:1px;" src="' $default_avatar .'" width="' $width '" alt="'$txt['default_avatar'], '" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>';
}
echo '</div><hr />';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo sp_embed_image('dot');

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '<a href="' $scripturl '?action=who">';

echo ' Online: ';

if (allowedTo('who_view') && !empty($modSettings['who_enabled']))
echo '</a>';

echo $combined;

} else {
if ($show_guests)
echo sp_embed_image('dot'), ' '$txt['guests'], ': '$stats['num_guests'] * $fake_online .'&nbsp;|&nbsp;';

if ($show_users)
echo sp_embed_image('dot'), ' 'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '<a href="' $scripturl '?action=who">' '''Users'allowedTo('who_view') && !empty($modSettings['who_enabled']) ? '</a>:&nbsp;' $stats['num_users_online'] : '';
}

if ($show_hidden)
echo '<br />' sp_embed_image('dot'), ' '$txt['hidden'] . ': ' $stats['num_users_hidden'];

if ($show_spiders && allowedTo('admin_forum'))
echo '&nbsp;|&nbsp;' sp_embed_image('dot'), ' '$txt['spiders'] . ': ' $stats['num_spiders'];

} elseif (
$mode == '3') {
echo '<div>';

echo '<a style="font-size:1.1em;" href="' $scripturl '?action=who">';

if ($show_guests_users) {
$number $stats['num_guests'] + $stats['num_users_online'];
$combined $number $fake_online;
echo $combined  .' Online';
} else {
if ($show_guests)
echo $stats['num_guests'] * $fake_online ' ' $txt['guests'] . ', ';

if ($show_users)
echo $stats['num_users_online'] . ' ' $txt['users'];
}
if ($show_hidden)
echo ' (' $stats['num_users_hidden'] . ' ' $txt['hidden'] . ')';

if ($show_spiders && allowedTo('admin_forum'))
echo ' (' $stats['num_spiders'] . ' ' $txt['spiders'] . ')';

echo '</a><br /><span class="last smalltext">Users active in past minutes:</span><br />';

foreach ($members as $member) {
if ($stats['num_users_online'] == '1')
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a> ';
else
echo '<a href="' $member['link'] . '">' $member['profile'] . '</a>, ';
}

echo '<hr /><span class="last smalltext">
'
$txt['most_online_today'], ': <strong>'comma_format($modSettings['mostOnlineToday']), '</strong>.
'
$txt['most_online_ever'], ': 'comma_format($modSettings['mostOnline']), ' ('timeformat($modSettings['mostDate']), ')
</span>'
;

echo '</div>';


} elseif (
$mode == '4') {

echo '<div style="overflow: auto; height: ' $scrollheight ';">';

$context += getUsersOnlineTodayStats();

echo sp_embed_image('dot'), ' '$txt['uot_total'], ': '$context['num_users_online_today'], '<br />';

if ($show_visible_today)
echo sp_embed_image('dot'), ' '$txt['uot_visible'], ': '$context['num_users_online_today'] - $context['num_users_hidden_today'] .'<br />';

if ($show_hidden_today)
echo sp_embed_image('dot'), ' '$txt['uot_hidden'], ': '$context['num_users_hidden_today'] .'<br />';


echo sp_embed_image('dot') . ' ' $txt['users'] . ':<br />

<ul class="sp_list"><li class="sp_list_indent">'
;

echo sp_embed_image('user') . ' ' implode('</li><li class="sp_list_indent">' sp_embed_image('user') . ' ' $context['list_users_online_today']);

echo '</ul></div>';

} else {

$context += getUsersOnlineTodayStats();

echo '<span style="font-size:1.1em;">' $context['num_users_online_today'], ' ' $txt['uot_total'] , ' ' $txt['users'] . '</span>';

if ($show_visible_today OR $show_hidden_today)
echo ' (';

if ($show_visible_today)
echo $txt['uot_visible'], ': ', ($context['num_users_online_today'] - $context['num_users_hidden_today']);

if ($show_visible_today AND $show_hidden_today)
echo ', ';

if ($show_hidden_today)
echo $txt['uot_hidden'], ': '$context['num_users_hidden_today'];

if ($show_visible_today OR $show_hidden_today)
echo ')';

// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($context['users_online_today']) && $context['viewing_allowed'])
{
echo
'<br />'implode(', '$context['list_users_online_today']);
}
}
?>
« Last Edit: September 05, 2011, 12:07:43 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.