collapse collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 900
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {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

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

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

0 Members and 3 Guests are viewing this topic.

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
[Block] Advanced Who's Online
« on: July 21, 2011, 06:00:19 PM »
Advanced Who's Online Block
[Made by Blue][I hope you like it =D]

Description: A block that shows who is online in 3 different ways totally customizable

SETUP INSIDE:
+ 5 Modes of Display: Simple Portal Who's Online with Avatar | Facebook like who's online | SMF forum like who's online | Online Today Simple Portal Who's Online (needs ONLINE TODAY MOD to work) | Online Today SMF forum like who's online (needs ONLINE TODAY MOD to work)
+ Set width and height of the avatar
+ Set URL of Default Avatar (if a user doesn't have one)
+ Show/Hide Guests, Users, Spiders and Hidden Users
+ Show Guests and Users combined as Online (e.g. Online: 7 people)
+ Increase Guest number by multiplying for the value of fake_online string

Author Notes:
I think that the default who's online block from simple portal is fine but some users need something better so I created this block.

Suggestions are welcome.

NEW VERSION:
1.1 -> Added Who's Online Today
1.2 -> Added Scrollbar to mode 4
1.3 -> Bug fix
1.4 -> Added mode 6; Added Scrollbar in mode 1; Added Usernames bellow avatar in mode 2

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

/* 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
// 6 = SimplePortal Block with Avatar PLUS Online Today SMF Forum like

$namebellowavatar true// If you want to show username bellow avatar (ONLY IN MODE 2)
$scrollbar true// Show scrollbar
$scrollheight '70px'; // Fixed Height before scrollbar appears (ONLY WORKS IF $scrollbar IS TRUE)
$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)
$text['OnlineToday'] = 'Users Online Today'// Translate it to your language (ONLY IN MODE 6)

$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 /><div ' 
. ($scrollbar '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') {

if (!$namebellowavatar)
echo '<div>';

foreach ($members as $member) {

if ($namebellowavatar)
echo '<div style="float: left;">';

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="" height="' $height '" align="middle" title="' $member['username'] . '" alt="' $member['username'] . '" />';
}

echo '</a>' . ($namebellowavatar '<br /><span style="text-align: center;">' $member['profile'] . '</span></div>' '');
}

if (!$namebellowavatar)
echo '</div>';

echo '<div ' . ($namebellowavatar 'style="clear: left;">' '>') . '<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'];

echo '</div>';

} 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 ' . ($scrollbar '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>';

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

$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']);
}

} else {

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 ' 
. ($scrollbar '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><hr />';

// Online Today

$context += getUsersOnlineTodayStats();

echo sp_embed_image('dot'), ' '$text['OnlineToday'], ': '$context['num_users_online_today'];

// 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: January 03, 2012, 02:56:27 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #1 on: July 21, 2011, 06:31:57 PM »
Can we keep the avatar proportions somehow ?

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #2 on: July 21, 2011, 06:47:41 PM »
Yes, here:

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 '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_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 /><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') . ' Online: ' $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: July 21, 2011, 06:58:45 PM by Blue »
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #3 on: July 21, 2011, 06:51:55 PM »
This is ok.

But in Facebook like mode there is no "who is online" link...

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #4 on: July 21, 2011, 06:57:20 PM »
Yes, there is ;) Click in "Users"
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline S@ffz

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Who's Online
« Reply #5 on: July 21, 2011, 07:03:55 PM »
yet another great Block thank you Blue  :D

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #6 on: July 21, 2011, 07:04:45 PM »
yet another great Block thank you Blue  :D

eheh! Thank you saffz :)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #7 on: July 21, 2011, 07:11:39 PM »
Yes, there is ;) Click in "Users"

The word "Users" is no displayed in the block when i put it in Facebook like mode...

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Who's Online
« Reply #8 on: July 21, 2011, 07:25:17 PM »
I know, you are working hard, but -LATER- think about support for the "User Online Today" Mod...

 :-[ ;)

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #9 on: July 21, 2011, 07:25:58 PM »
You are right. I forgot to add the link when guest and users are combined.

Here:
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 '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_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 /><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>';
}
?>

I know, you are working hard, but -LATER- think about support for the "User Online Today" Mod...

 :-[ ;)

It's going to be in 1.1 version ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Yngwiedis

  • Jr. Member
  • **
  • Posts: 67
  • SMF Version: None
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #10 on: July 21, 2011, 07:39:08 PM »
You are right. I forgot to add the link when guest and users are combined.


Its ok now :)

Thank you very very much.

Offline rocknroller

  • Jr. Member
  • **
  • Posts: 51
  • Gender: Male
  • Simple portal is great
    • Mini Chat - Domaca Pricaonica
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: [Block] Advanced Who's Online
« Reply #11 on: July 22, 2011, 12:05:47 PM »
awesome :D
« Last Edit: July 22, 2011, 12:09:20 PM by rocknroller »
Tražite li mjesto za opuštanje, zabavu, Besplatno Upoznavanje, brbljanje i pricanje tu je Mini Chat HR, Domaci sajt sadrži sobe za druženje tj. chat za mobitel, isto kao i za stolna racunala. I to bez prijave email adrese, najbolje pricaonice su MiniChatHR.com

Offline RaulVK

  • Semi Newbie
  • *
  • Posts: 35
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Advanced Who's Online
« Reply #12 on: July 24, 2011, 12:15:48 PM »
You could add a box-shadow in mode 2?. Depending on the user group it is, change color.

Sample:

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #13 on: July 24, 2011, 09:02:10 PM »
I know, you are working hard, but -LATER- think about support for the "User Online Today" Mod...

 :-[ ;)

Done :) Version 1.1 Uploaded

You could add a box-shadow in mode 2?. Depending on the user group it is, change color.

Sample:

It's going to be possible in version 1.2 ;)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Who's Online
« Reply #14 on: July 25, 2011, 03:47:04 PM »
@Blue: Thank you, worked like a charm...

It is possible to show the "user online today" with a scroll-bar (not the complete list)?

The code for the shadow you can find here:
http://www.skinmod.eu/index.php?topic=1028.0

Offline RaulVK

  • Semi Newbie
  • *
  • Posts: 35
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Advanced Who's Online
« Reply #15 on: July 26, 2011, 08:08:56 PM »
You could add a box-shadow in mode 2?. Depending on the user group it is, change color.

Sample:

It's going to be possible in version 1.2 ;)

Thanksss!!!!! :nervous-happy:

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #16 on: July 31, 2011, 01:09:39 PM »
It is possible to show the "user online today" with a scroll-bar (not the complete list)?

It's done Divecall ;)

Version 1.2 released.
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline Divecall

  • Full Member
  • ***
  • Posts: 201
  • SMF Version: 2.0.2
  • SP Version: 2.3.5
Re: [Block] Advanced Who's Online
« Reply #17 on: August 01, 2011, 07:34:12 PM »
Thank you, Sir!

Offline Blue

  • Customizer
  • *
  • Posts: 379
  • Gender: Male
  • Block Maker? =P
Re: [Block] Advanced Who's Online
« Reply #18 on: August 02, 2011, 07:35:20 PM »
Glad you liked :)
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Offline raffo

  • Jr. Member
  • **
  • Posts: 70
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: [Block] Advanced Who's Online
« Reply #19 on: August 10, 2011, 03:39:32 AM »
i'm not able to see the avatars of about 95% of my users... do u know why?