SimplePortal

Customization => Custom Coding => Topic started by: Divecall on September 18, 2010, 05:02:56 PM

Title: What are members doing - Block
Post 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
Title: Re: What are members doing - Block
Post by: smithc6 on September 20, 2010, 02:17:35 AM
this would be good i'd be interested in this also pls
Title: Re: What are members doing - Block
Post by: Divecall on September 20, 2010, 09:34:42 AM
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)
Title: Re: What are members doing - Block
Post by: Divecall on September 20, 2010, 11:24:06 AM
sounds a little silly, and it sounds more easy, than to do...

but we need only a modified "Who is online Block" i think...
Title: Re: What are members doing - Block
Post by: Maarten on September 20, 2010, 11:39:38 AM
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!
Title: Re: What are members doing - Block
Post by: Divecall on September 20, 2010, 12:08:54 PM
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.
Title: Re: What are members doing - Block
Post by: Divecall on September 25, 2010, 05:30:06 PM
Here is the code from the "PortalBlocks.php" to show the user online:
Code: [Select]
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)
Code: [Select]
// 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']))
Title: Re: What are members doing - Block
Post by: Divecall on October 08, 2010, 04:31:29 PM
Nobody an idea ?
Title: Re: What are members doing - Block
Post by: ccbtimewiz on October 08, 2010, 10:44:06 PM
Find:
Code: [Select]
foreach ($stats['users_online'] as $user)
Replace with:
Code: [Select]
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.
Title: Re: What are members doing - Block
Post by: Divecall on October 10, 2010, 06:12:46 AM
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...
Title: Re: What are members doing - Block
Post by: ccbtimewiz on October 10, 2010, 01:04:17 PM
It should only output information.

Can you copy/paste all of it?
Title: Re: What are members doing - Block
Post by: Divecall on October 10, 2010, 05:02:26 PM
sure, here is the complete code...
Code: [Select]
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>';
   }

Title: Re: What are members doing - Block
Post by: ccbtimewiz on October 10, 2010, 09:33:14 PM
I meant what it outputted....
Title: Re: What are members doing - Block
Post by: Divecall on October 12, 2010, 06:17:02 PM
OK, i understand... :-[

Here is the output between "user online" and my name:
Code: [Select]
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
        )

)
SimplePortal 2.3.8 © 2008-2024, SimplePortal