SimplePortal
Customization => Custom Coding => Topic started by: Divecall on September 18, 2010, 05:02:56 PM
-
Hi !
Can somebody write a block, that shows what members (who are online right now) doing ?
e.g.
[AVATAR] [MEMBERNAME] read Help Topic
[AVATAR] [MEMBERNAME] write a topic in showcase
[AVATAR] [MEMBERNAME] looking Admins Profile
[AVATAR] [MEMBERNAME] play Spinning Bubbles in Arcade
[AVATAR] [MEMBERNAME] write an answer HERE
[AVATAR] [MEMBERNAME looking the homepage
and so on....
Thank you in Advance
-
this would be good i'd be interested in this also pls
-
maybe this mod can help (parse the code and look to it) but really, i am not a good coder...
http://custom.simplemachines.org/mods/index.php?mod=2593 (http://custom.simplemachines.org/mods/index.php?mod=2593)
-
sounds a little silly, and it sounds more easy, than to do...
but we need only a modified "Who is online Block" i think...
-
Nah, this isn't really a good future. I don't think I want my peeps to know that I am looking at someones profile.
Especially since this is an admin/main moderator option on my forum only!
I don't think this is worth scripting for just one guy. I mean this isn't really an future many people are interested in.
BTW, you ain't be allowed to dubble post. Watch it!
-
Well, its my decision if this is a good feature or not. Here you can find a lot of usefull code - but some parts are interesting, some not - thats my opinion what i use or not.
Imagine i have a small, private but good community and my members was asking for this. What now ?
And my first post starts with "can somebody write a block...", not "Is this a nice feature or not".
And i think you have not the position in this board to moderate other members.
-
Here is the code from the "PortalBlocks.php" to show the user online:
function sp_whosOnline($parameters, $id, $return_parameters = false)
{
global $scripturl, $sourcedir, $modSettings, $txt;
$block_parameters = array(
'online_today' => 'check'
);
if ($return_parameters)
return $block_parameters;
$online_today = !empty($parameters['online_today']);
$stats = ssi_whosOnline('array');
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">', sp_embed_image($user['name'] == 'H' ? 'tux' : 'user'), ' ', $user['hidden'] ? '<em>' . $user['link'] . '</em>' : $user['link'], '</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>';
}
}
Have somebody an Idea how to add this part code ? (Activity in Profil - Mod)
// Display the member's current activity
if (isset($context['member']['action']) && allowedTo('who_view')) {
echo '<dt>', $txt['current_activity'], ': </dt>
<dd>', $context['member']['action'], '</dd>';
}
if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
-
Nobody an idea ?
-
Find:
foreach ($stats['users_online'] as $user)
Replace with:
echo '<pre>';
print_r($stats['users_online']);
echo '</pre>';
foreach ($stats['users_online'] as $user)
That's a start. Tell me the results that come out of that, if action or other keys are present I can help you build this block.
-
At first Thank you for to help me (us).
But unfortunatly this code is not working well (good is that i have no errors), i have only this output, see picture...
-
It should only output information.
Can you copy/paste all of it?
-
sure, here is the complete code...
global $scripturl, $sourcedir, $modSettings, $txt;
$block_parameters = array(
'online_today' => 'check'
);
if ($return_parameters)
return $block_parameters;
$online_today = !empty($parameters['online_today']);
$stats = ssi_whosOnline('array');
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">';
echo '<pre>';
print_r($stats['users_online']);
echo '</pre>';
foreach ($stats['users_online'] 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>';
}
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>';
}
-
I meant what it outputted....
-
OK, i understand... :-[
Here is the output between "user online" and my name:
Array
(
[1286921684Divecall] => Array
(
[id] => 1
[username] => Divecall
[name] => Divecall
[group] => 1
[href] => http://my/path/index.php?action=profile;u=1
[link] => Divecall
[is_buddy] =>
[hidden] =>
[is_last] => 1
)
)