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.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 319
  • 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]

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

Author Topic: Who's Online Block  (Read 4835 times)

0 Members and 1 Guest are viewing this topic.

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Who's Online Block
« on: June 26, 2010, 12:43:13 PM »
Hello !
Can you help me to change my "who's online block??"

I would like to have the list of users online, and their avatar next to them (instead of this )
And if possible, when clicking avatar, being redirect to "send a private message" to this member.

Is it possible please??
Thank you very much!!

smf 2.0 RC3
SP : 2.3.2
« Last Edit: June 27, 2010, 04:36:18 AM by gossebezak »

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Re: Who's Online Block adjustment
« Reply #1 on: June 26, 2010, 11:28:21 PM »
Split from the other topic, this is a completely different issue.
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block adjustment
« Reply #2 on: June 27, 2010, 04:35:21 AM »
ok sorry  ;)

Somebody can help me please??  :thumbsup:
thanks!

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #3 on: June 29, 2010, 01:08:19 PM »
Hello,
I would like to have something like that.



with a direct link on avatar to PM.

Can somebody help me??
I'm a newie with the php code  :D
Thanks

Offline York

  • Newbie
  • Posts: 2
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #4 on: July 01, 2010, 12:19:13 PM »
I am also very interested by this modification.
Someone can help us ?
Please  :thumbsup:

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Who's Online Block
« Reply #5 on: July 02, 2010, 10:31:35 PM »
Find the 'sp_WhosOnline' function in your 'Sources/PortalBlocks.php' file and replace it with the function below:

Code: [Select]
function sp_whosOnline($parameters, $id, $return_parameters = false)
{
global $scripturl, $sourcedir, $modSettings, $txt, $smcFunc;

$block_parameters = array(
'online_today' => 'check'
);

if ($return_parameters)
return $block_parameters;

$online_today = !empty($parameters['online_today']);

$stats = ssi_whosOnline('array');

$members = array();
foreach ($stats['users_online'] as $user)
$members[] = $user['id'];

if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

$request = $smcFunc['db_query']('','
SELECT
m.id_member, m.avatar,
a.id_attach, a.attachment_type, a.filename
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}attachments AS a ON (a.id_member = m.id_member)
WHERE m.id_member in ({array_int:members})',
array(
'members' => $members,
)
);

$avatars = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$avatars[$row['id_member']] = array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? '<img src="' . (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['id_attach'] > 0 ? (empty($row['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $row['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
);
}
$smcFunc['db_free_result']($request);

echo '
<ul class="sp_list">
<li>', sp_embed_image('dot'), ' ', $txt['guests'], ': ', $stats['num_guests'], '</li>';

if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')))
echo '
<li>', sp_embed_image('dot'), ' ', $txt['spiders'], ': ', $stats['num_spiders'], '</li>';

echo '
<li>', sp_embed_image('dot'), ' ', $txt['hidden'], ': ', $stats['num_users_hidden'], '</li>
<li>', sp_embed_image('dot'), ' ', $txt['users'], ': ', $stats['num_users_online'], '</li>';

if (!empty($stats['users_online']))
{
echo '
<li>', 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>' : '', ':</li>
</ul>
<div class="sp_online_flow">
<ul class="sp_list">';

foreach ($stats['users_online'] as $user)
echo '
<li class="sp_list_indent">', $avatars[$user['id']]['image'], ' <span style="vertical-align: top;">', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'], '</span></li>';

echo '
</ul>
</div>';
}
else
{
echo '
</ul>
<br />
<div class="sp_fullwidth sp_center">', $txt['error_sp_no_online'], '</div>';
}

if ($online_today && file_exists($sourcedir . '/Subs-MembersOnlineToday.php'))
{
require_once($sourcedir . '/Subs-MembersOnlineToday.php');

$membersOnlineTodayOptions = array(
'sort' => 'login_time',
'reverse_sort' => true,
'period' => 'current_day',
'canview' => 'registered',
);

$stats += getMembersOnlineTodayStats($membersOnlineTodayOptions);

if (empty($stats['num_users_online_today']))
return;

echo '
<ul class="sp_list">
<li>', sp_embed_image('dot'), ' ', $txt['sp-online_today'], ': ', $stats['num_users_online_today'], '</li>
</ul>
<div class="sp_online_flow">
<ul class="sp_list">';

foreach ($stats['users_online_today'] as $user)
echo '
<li class="sp_list_indent">', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'], '</li>';

echo '
</ul>
</div>';
}
}
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #6 on: July 03, 2010, 01:25:11 PM »
Thank you very much!! It's a great change for my website
how can i change the size of the avatar?? I would like to have avatar : 40 x 40 .

Thank you again!  :D

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Who's Online Block
« Reply #7 on: July 03, 2010, 10:31:50 PM »
Code: ("Find (in that function)") [Select]
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
{
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
}
else
{
$avatar_width = '';
$avatar_height = '';
}

Code: ("Replace") [Select]
$avatar_width = '40';
$avatar_height = '40';
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #8 on: July 04, 2010, 07:28:09 AM »
 :nervous-happy: Thanks for your help but it doesn't change the avatar size.
I still have this... :(




Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Who's Online Block
« Reply #9 on: July 04, 2010, 09:49:45 PM »
Whoops, try this:
Code: [Select]
$avatar_width = ' width="40"';
$avatar_height = ' height="40"';
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #10 on: July 05, 2010, 06:57:48 AM »
hum... still doesn't work  :0
Thank you very much for your help  :thumbsup:

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #11 on: July 07, 2010, 06:47:01 AM »
In other blocks, where the avatar are resized, there is this code : (in topmember bloc here)

Code: [Select]
foreach ($members as $member)
echo '
<tr>
<td class="sp_top_poster sp_center">', !empty($member['avatar']['href']) ? '
<img src="' . $member['avatar']['href'] . '" alt="' . $member['name'] . '" width="40" />' : '', '
</td>
<td>
', $member['link'], '<br />
', $member['posts'], ' ', $txt['posts'], '
</td>
</tr>';

echo '
</table>';

Is it possible to ingrate this kind of code in my bloc? Maybe it can work...
Thank you

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #12 on: July 12, 2010, 05:23:23 PM »
Any idea??  ;)

Offline gossebezak

  • Semi Newbie
  • *
  • Posts: 12
  • Gender: Male
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Who's Online Block
« Reply #13 on: September 19, 2010, 12:01:34 PM »
Humm I Up the topic  :D
Can somebody help me to find what's wrong in this code.
The avatars are big, and not 40x40...

I try but I don't find the solution.  :|