I use :
TinyPortal v1.0.5
SMF 1.1.5
I want to know how to post users logged in today on TP stats after usesr online? i don't know if TP teams let us to make this on stat?
Thank
Take a look in the Block Codes Snippets boards, you should find what you need there.
There are several versions, as Ken stated, please check the block code snippets board.
Thank to Help,i have to find all topics about users online today, that say you must modify ssi.php and TPortalBlocks.template.php or use phpbox code.
So i already change my SSI.php and use phpbox code that work but i have a error on my forum admin (Forum Error Log).
and i want only Users Logged In Today not users online cause on tp stat have already!
Check on the SMF forums, there is a mod for "Users Online Today", it may give you what you need.
i have already this mod user online today from smf, but that i want is Users Logged In Today on TP Stats!
For exemple on TP STATS :
STATS
Members
Total Members: 141
Latest: vickilove
Stats
Total Posts: 871
Total Topics: 149
Online Today: 13
Online Ever: 160
(May 09, 2008, 10:12:46 AM)
Users Online
Users: 0
Guests: 14
Total: 14
Users Logged In Today :
Kanita, vickin_0i, chester777
before i already have this but i have updated my tp that why i don't have it,cause tp stats don't show users logged in today automatically.
Any Help? No Help :-\
link to your site?
Quote
before i already have this but i have updated my tp that why i don't have it,cause tp stats don't show users logged in today automatically.
im lost, you had this mod, but you do not have it now?
ok before i have used this http://www.tinyportal.net/index.php?topic=2365.msg97902#msg97902 look at this topic but now i update tp in TP v1.0.5 so TPortalBlocks.template.php is change, now name is TBlocks.template.php and the code inside not a same..
That why i want to know how can i do a change? i have already changed my SSI.php and use a code on phpblock, look like this topic code http://www.tinyportal.net/index.php?topic=2365.msg20286#msg20286 only change my SSI.php and use phpblock that is working but i have a error on my Forum Error Log.
i have this now
STATS
Members
Total Members: 141
Latest: vickilove
Stats
Total Posts: 871
Total Topics: 149
Online Today: 13
Online Ever: 160
(May 09, 2008, 10:12:46 AM)
Users Online
Users: 0
Guests: 14
Total: 14
in phpblock Users Online Today
Users: 0 Guests: 14
Users Logged In Today :
Kanita, vickin_0i, chester777
How can i have only Users Logged In Today in Stats Box??
Users Logged In Today :
Kanita, vickin_0i, chester777
To get it in a box, you must have the "engine" for the function.
Im not sure i have managd to follow your posts correctly as you seem to change the info in every post right now.
I suggest you start over with fresh files ( the ones you have edit allready ) and go from there again.
The block itself cannot show any ssi info thats not implemented in some way in your smf files. so you need to have the mod installed first and then call for the function inside a block.
ok i understand! i know now how to do!! :) THank everybody!
Is there some 'easy' method to appear inside stats block or in new (separate block) the "Users Logged In Today" function ..?
because i confuse what exactly is the right way about.. ???
Put this in your SSI.php file:
function ssi_whosOnline_today($output_method = 'echo')
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $settings;
//global $context;
// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);
$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$return['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$return['buddies']++;
$link = '<b>' . $link . '</b>';
}
$return['users'][$row['logTime'] . $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,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$return['hidden']++;
}
mysql_free_result($result);
if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];
// Hidden users, or buddies?
if ($return['hidden'] > 0 || $show_buddies)
echo '
(' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';
echo '<br />';
foreach ($return['users'] as $user)
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';
echo'</div><br /><hr>';
}
// Load the users online today.
$nowdate = getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);
// $midnight = strtotime('24 hours ago');
$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__);
$return['users_online_today'] = array();
$return['list_users_online_today'] = array();
while ($row = mysql_fetch_assoc($result))
{
$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 = (allowedTo('moderate_forum') || !empty($row['showOnline'])) ? ' title="' . $lastLogin . '"' : '';
// Some basic color coding...
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>';
}
$is_online = false;
if ($return['num_users']>0)
{
foreach($return['users'] as $user)
{
if ($user['id'] == $row['ID_MEMBER'])
{
$is_online = true;
}
}
}
$return['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,
'is_online' => $is_online,
'hidden' => empty($row['showOnline']),
);
$return['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = (empty($row['showOnline']) && allowedTo('moderate_forum')) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);
krsort($return['users_online_today']);
krsort($return['list_users_online_today']);
$return['num_users_online_today'] = count($return['users_online_today']);
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo $return['num_users_online_today'], ' ', $return['num_users_online_today'] == 1 ? strtolower($txt['user']) : strtolower($txt['users']);
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($return['users_online_today']))
echo '
', 'online today', ':<br />', implode(', ', $return['list_users_online_today']);
echo '
<br />', $return['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>';
}
else
return $return;
}
Put this in a block:
ssi_whosOnline_today();
Hey JPDeni, thanks for your reply ! :)
But this code create this error:
Fatal error: Call to undefined function ssi_whosOnline_today() in /var/www/vhosts/adultforumgr.com/httpdocs/Themes/default/TPBlocks.template.php(48) : eval()'d code on line 1 :-\
Did you put the code in your SSI.php file?
Thanks IchBin ! i forget to upload the edited file..! :D ;D works great after all ! :up:
Now work perfect, thanks JPDeni !! :) :)
But show me not only the users logged in today in this block, show me also users online in the same block.. and i already have up another block with "Stats block" so i thing is too match to see 3 times the same usermames..
See what i mean:
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg268.imageshack.us%2Fimg268%2F9444%2Fclipboard01ah.png&hash=4a1b3b03ba325779f2843542c20f678b2e834eef)
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg705.imageshack.us%2Fimg705%2F8727%2Fclipboard02.png&hash=e0e9009ce71a0f66df30171448ed669468c5d3f4)
or just see the home page
http://www.adultforumgr.com/index.php
Is possible to remove the "users online" option in "users logged in today" block..?
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg109.imageshack.us%2Fimg109%2F9262%2Fclipboard.png&hash=5b37a7316102b357a43658fc6caba8fe9f451bc0)
and something else: how to make bold the usernames in "stats" block..? through CSS or..?
Use this instead.
function ssi_whosOnline_today($output_method = 'echo')
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $settings;
//global $context;
// Load the users online today.
$nowdate = getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);
// $midnight = strtotime('24 hours ago');
$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__);
$return['users_online_today'] = array();
$return['list_users_online_today'] = array();
while ($row = mysql_fetch_assoc($result))
{
$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 = (allowedTo('moderate_forum') || !empty($row['showOnline'])) ? ' title="' . $lastLogin . '"' : '';
// Some basic color coding...
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>';
}
$is_online = false;
if ($return['num_users']>0)
{
foreach($return['users'] as $user)
{
if ($user['id'] == $row['ID_MEMBER'])
{
$is_online = true;
}
}
}
$return['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,
'is_online' => $is_online,
'hidden' => empty($row['showOnline']),
);
$return['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = (empty($row['showOnline']) && allowedTo('moderate_forum')) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);
krsort($return['users_online_today']);
krsort($return['list_users_online_today']);
$return['num_users_online_today'] = count($return['users_online_today']);
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo $return['num_users_online_today'], ' ', $return['num_users_online_today'] == 1 ? strtolower($txt['user']) : strtolower($txt['users']);
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($return['users_online_today']))
echo '
', 'online today', ':<br />', implode(', ', $return['list_users_online_today']);
echo '
<br />', $return['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>';
}
else
return $return;
}
I don't know off the top of my head how to bold the usernames in the stats block.
is there can make hidden users completely not showed for everyone include admin?
or how can i remove admin online in the list... tq
To not show the hidden members at all, change
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';
to
echo $user['hidden'] ? '' : $user['link'], $user['is_last'] ? '' : ', ';
To not show admins will take more changing of the code.
Haven't tried JPDeni's edit but if you have your Admins change their profiles to be hidden when online, it may work. Just a guess though.
ZarPrime
hope is there a trick to remove all information about hidden username include admin or user can manage member also cant see the hidden users... tq
Huh? :D :o
ZarPrime
I'm with ZP. Not a clue what you mean, Mrcare. The change I posted will remove the hidden user names. Have you tried it?
Quote from: JPDeni on January 26, 2010, 05:36:31 PM
I'm with ZP. Not a clue what you mean, Mrcare. The change I posted will remove the hidden user names. Have you tried it?
yes.. but it still there.. the membergroup that have the "manage members" permission still can see the italic hidden name. tq
Quote from: Mrcare on January 27, 2010, 12:25:21 AM
Quote from: JPDeni on January 26, 2010, 05:36:31 PM
I'm with ZP. Not a clue what you mean, Mrcare. The change I posted will remove the hidden user names. Have you tried it?
yes.. but it still there.. the membergroup that have the "Moderate forum members" permission still can see the italic hidden name. tq
Okay. Try this
function ssi_whosOnline_today($output_method = 'echo')
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $settings;
//global $context;
// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);
$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$return['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$return['buddies']++;
$link = '<b>' . $link . '</b>';
}
$return['users'][$row['logTime'] . $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,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$return['hidden']++;
}
mysql_free_result($result);
if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];
// Hidden users, or buddies?
if ($return['hidden'] > 0 || $show_buddies)
echo '
(' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';
echo '<br />';
foreach ($return['users'] as $user)
echo $user['hidden'] ? '' : $user['link'], $user['is_last'] ? '' : ', ';
echo'</div><br /><hr>';
}
// Load the users online today.
$nowdate = getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);
// $midnight = strtotime('24 hours ago');
$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__);
$return['users_online_today'] = array();
$return['list_users_online_today'] = array();
while ($row = mysql_fetch_assoc($result))
{
$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 = (allowedTo('moderate_forum') || !empty($row['showOnline'])) ? ' title="' . $lastLogin . '"' : '';
// Some basic color coding...
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>';
}
$is_online = false;
if ($return['num_users']>0)
{
foreach($return['users'] as $user)
{
if ($user['id'] == $row['ID_MEMBER'])
{
$is_online = true;
}
}
}
$return['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,
'is_online' => $is_online,
'hidden' => empty($row['showOnline']),
);
$return['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = (empty($row['showOnline']) && allowedTo('moderate_forum')) ? '' : $link;
}
mysql_free_result($result);
krsort($return['users_online_today']);
krsort($return['list_users_online_today']);
$return['num_users_online_today'] = count($return['users_online_today']);
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo $return['num_users_online_today'], ' ', $return['num_users_online_today'] == 1 ? strtolower($txt['user']) : strtolower($txt['users']);
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($return['users_online_today']))
echo '
', 'online today', ':<br />', implode(', ', $return['list_users_online_today']);
echo '
<br />', $return['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>';
}
else
return $return;
}
And then come back and tell us what happened.
yes.... what i can say is.. very nica job.. tq
but to one more thing is.. in the empty name of the hidden name is is taking place by or show ", , ,"
Also.. when i try to del/change in TPBlocks.template
foreach($online['users'] as $user)
{
[b]echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'];[/b]
echo '<br />';
}
echo '
</div></div>';
}
echo '
</div>';
}
to
[b]echo $user['hidden'] ? '' : $user['link'];[/b]
i will become free/blank row. tq
Use this instead
function ssi_whosOnline_today($output_method = 'echo')
{
global $txt, $scripturl, $db_prefix, $ID_MEMBER, $user_info, $sourcedir;
global $modSettings, $settings;
//global $context;
// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
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.showOnline = 1", __FILE__, __LINE__);
$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);
while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$return['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" style="color: ' . $row['onlineColor'] . ';">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';
// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$return['buddies']++;
$link = '<b>' . $link . '</b>';
}
$return['users'][$row['logTime'] . $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,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$return['hidden']++;
}
mysql_free_result($result);
if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];
// Hidden users, or buddies?
if ($return['hidden'] > 0 || $show_buddies)
echo '
(' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';
echo '<br />';
foreach ($return['users'] as $user)
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';
echo'</div><br /><hr>';
}
// Load the users online today.
$nowdate = getdate(forum_time(false));
$midnight = mktime(0, 0, 0, $nowdate['mon'], $nowdate['mday'], $nowdate['year']) - ($modSettings['time_offset'] * 3600);
// $midnight = strtotime('24 hours ago');
$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
AND mem.showOnline = 1", __FILE__, __LINE__);
$return['users_online_today'] = array();
$return['list_users_online_today'] = array();
while ($row = mysql_fetch_assoc($result))
{
$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 = (allowedTo('moderate_forum') || !empty($row['showOnline'])) ? ' title="' . $lastLogin . '"' : '';
// Some basic color coding...
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>';
}
$is_online = false;
if ($return['num_users']>0)
{
foreach($return['users'] as $user)
{
if ($user['id'] == $row['ID_MEMBER'])
{
$is_online = true;
}
}
}
$return['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,
'is_online' => $is_online,
'hidden' => empty($row['showOnline']),
);
$return['list_users_online_today'][$row['lastLogin'] . $row['memberName']] = (empty($row['showOnline']) && allowedTo('moderate_forum')) ? '<i>' . $link . '</i>' : $link;
}
mysql_free_result($result);
krsort($return['users_online_today']);
krsort($return['list_users_online_today']);
$return['num_users_online_today'] = count($return['users_online_today']);
// echo to screen?
if ($output_method == 'echo')
{
echo '
<div class="smalltext">';
echo $return['num_users_online_today'], ' ', $return['num_users_online_today'] == 1 ? strtolower($txt['user']) : strtolower($txt['users']);
// Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
if (!empty($return['users_online_today']))
echo '
', 'online today', ':<br />', implode(', ', $return['list_users_online_today']);
echo '
<br />', $return['show_stats'] && !$settings['show_sp1_info'] ? '
<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
</div>';
}
else
return $return;
}
QuoteAlso.. when i try to del/change in TPBlocks.template
Don't change TPBlocks.template.
tq soo much.. how can i apply this code to tpblock online users to hide hidden users from showing to moderator that can menage members? what must i change in TPBlocks.template or ssi.php?
Actually, I'm having trouble understanding why you would want to remove all trace of hidden members from your site from Admins and Moderators. Don't you want to know who is prowling around your site so that you can check up on them once in a while to make sure they are not up to no good? This is confusing.
ZarPrime
Quote from: Mrcare on January 28, 2010, 04:48:03 AM
tq soo much.. how can i apply this code to tpblock online users to hide hidden users from showing to moderator that can menage members? what must i change in TPBlocks.template or ssi.php?
Just use the code in a php block.
were in the SSi file do u add this ?
You can add that whole chunk of code right before the closing PHP tag ?> at the end of the file.
just did that and i get a white blank screen when saving the block, when i remove code from SSI.PHP it works again.
i must be doing something wrong hmmmm
have attached the SSI.PHP if any 1 cares to have a look be grateful thanks
no 1 willing to help i keep adding the above code and i keep getting a white page
also now when i added the smaller code to a php block getting this error
Unknown column 'lo.logTime' in 'field list'
File: /home/goseafis/public_html/SSI.php
Line: 1993
This code is only working with SMF1.x right now. The code needs to be converted to work with SMF2. Some of the rows in the tables have changed names as well as the query structure. I don't have the time to do this for you right now.
oh ok thanks for telling me got it working installed users online smf mod but thanks for the reply