SimplePortal

Support => International Support => German => Topic started by: Divecall on January 29, 2010, 07:02:28 PM

Title: Wer ist Online-Block
Post by: Divecall on January 29, 2010, 07:02:28 PM
In dem "Wer ist Online"-Block, kann man einen Haken setzen bei "Zeigt die Mitglieder an, die heute online waren".

Wenn ich dort jedoch die Funktion einschalte (aktiviere), werden mir trotzdem nur die aktuellen Mitglieder angezeigt, nicht jedoch wer heute schon alles online war.

Benötige ich für diese Option noch ein SMF-Mod ? (Users online today-Mod)

Danke für eure Hilfe.
Title: Re: Wer ist Online-Block
Post by: Hannilein on February 01, 2010, 09:34:29 AM
Hallo,
ich habe den "Users Online Today Mod" (http://custom.simplemachines.org/mods/index.php?mod=217) in meinem Forum installiert. Möglicherweise setzt die Portal-Funktion einen installierten Mod voraus, ich weiß es nicht mehr, da ich den Mod schon vor dem Portal drin hatte. Im Portal nutze ich dann folgenden Code in einem Custom-PHP-Block um mir die heute aktiven Benutzer anzeigen zu lassen:

Code: [Select]
global $db_prefix, $user_info, $context, $scripturl, $modSettings, $txt;

$block_parameters = array();

if ($return_parameters)
return $block_parameters;

$stats = ssi_whosOnline('array');

if (!empty($txt['uot_users_online_today']))
{
$date = @getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']) - ($modSettings['time_offset'] * 3600);

$s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
$time_fmt = '%I:%M' . $s . ' %p';
else
$time_fmt = '%H:%M' . $s;

$result = db_query("
SELECT
mem.ID_MEMBER, mem.lastLogin, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP, mg.groupName
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP)) WHERE mem.lastLogin >= $midnight", __FILE__, __LINE__);

$stats['num_hidden_users_online_today'] = 0;
$stats['users_online_today'] = array();
$stats['list_users_online_today'] = array();

while ($row = mysql_fetch_assoc($result))
{
if (empty($row['showOnline']))
{
$stats['num_hidden_users_online_today'] = $stats['num_hidden_users_online_today'] + 1;
if (!$user_info['is_admin'])
continue;
}

$userday = strftime('%d', forum_time(true));
$loginday = strftime('%d', forum_time(true, $row['lastLogin']));
$yesterday = $userday == $loginday ? '' : $txt['uot_yesterday'];

$lastLogin = $yesterday . strftime($time_fmt, forum_time(true, $row['lastLogin']));
$title = ' title="' . $lastLogin . '"';

if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . ' style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '"' . $title . '>' . $row['realName'] . '</a>';

$is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']);
if ($is_buddy)
$link = '<b>' . $link . '</b>';

$stats['users_online_today'][$row['lastLogin'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'is_buddy' => $is_buddy,
'hidden' => empty($row['showOnline']),
);

$stats['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = empty($row['showOnline']) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);

krsort($stats['users_online_today']);
krsort($stats['list_users_online_today']);

$stats['num_users_online_today'] = count($stats['users_online_today']);
if (!$user_info['is_admin'])
$stats['num_users_online_today'] = $stats['num_users_online_today'] + $stats['num_hidden_users_online_today'];

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>';
}

Ich habe dies als extra-Block eingebaut, weil einige User an der Info nicht interessiert sind und diesen Teil zuklappbar haben wollten. Beispielansicht gibts in meinem Forum, siehe Sig.

Grüzilein

SimplePortal 2.3.8 © 2008-2024, SimplePortal