who.template.php

Started by Owdy, June 10, 2004, 01:17:25 PM

Previous topic - Next topic

Owdy

Ho do i change that code so only users show in that list? By themes, not from sources. I try to separate them like in phpBB.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

[Unknown]

Just check the ['id'].  If it's 0, don't show it.

-[Unknown]

Oldiesmann

Hmmm... That works as well... I was thinking it would be easier just to remove "OR lo.ID_MEMBER=0" from the query in Sources/Who.php
Michael Eshom
Christian Metal Fans

Owdy

I dont wanna hack sources ;) I try to put users and guests in differend areas, just like phpBB does.
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

[Unknown]

Just use something like this at the top of a loop:

if ($member['id'] == 0)
   continue;

And then copy the look and change it to:

if ($member['id'] != 0)
   continue;

Then, the first loop will be guests and the second members.  (you can do it in reverse order too.)

-[Unknown]

Owdy

#5
Hey! Perfect! Thanks!  :D
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Owdy

Hmmm, current code:

<?php

// The only template in the file.
function template_main()
{
global $context$settings$options$scripturl$txt;

// Display the table header and linktree.
echo '
<div style="padding: 3px;">'
theme_linktree(), '</div>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr>
<td class="titlebg2">Jäsenet foorumilla</td></tr></table>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr class="titlebg">
<td width="30%"><a href="' 
$scripturl '?action=who;sort=user'$context['sort_direction'] == 'down' && $context['sort_by'] == 'user' ';asc' '''">'$txt['who_user'], ' '$context['sort_by'] == 'user' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>
<td style="width: 14ex;"><a href="' 
$scripturl '?action=who;sort=time'$context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ';asc' '''">'$txt['who_time'], ' '$context['sort_by'] == 'time' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>
<td>'
$txt['who_action'], '</td>
</tr>'
;

// This is used to alternate the color of the background.
$alternate true;

// For every member display their name, time and action (and more for admin).
foreach ($context['members'] as $member)
{
// $alternate will either be true or false.  If it's true, use "windowbg2" and otherwise use "windowbg".
echo '
<tr class="windowbg'
$alternate '2' '''">
<td>'
;
if (
$member['id'] == 0)
   continue;
// Guests don't have information like icq, msn, y!, and aim... and they can't be messaged.
if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
'
$context['can_send_pm'] ? '<a href="' $member['online']['href'] . '" title="' $member['online']['label'] . '">' ''$settings['use_image_buttons'] ? '<img src="' $member['online']['image_href'] . '" alt="' $member['online']['text'] . '" border="0" align="middle" />' $member['online']['text'], $context['can_send_pm'] ? '</a>' '''
'
$member['icq']['link'], ' '$member['msn']['link'], ' '$member['yim']['link'], ' '$member['aim']['link'], '
</div>'
;
}

echo '
<span'
$member['is_hidden'] ? ' style="font-style: italic;"' '''>'$member['is_guest'] ? $member['name'] : '<a href="' $member['href'] . '" title="' $txt[92] . ' ' $member['name'] . '"' . (empty($member['color']) ? '' ' style="color: ' $member['color'] . '"') . '>' $member['name'] . '</a>''</span>';

if (!empty($member['ip']))
echo '
(<a href="' 
$scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank">' $member['ip'] . '</a>)';

echo '
</td>
<td nowrap="nowrap">'
$member['time'], '</td>
<td>'
$member['action'], '</td>
</tr>

'
;

// Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
$alternate = !$alternate;
}
echo '
</table><br>
//visitors start here
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr>
<td class="titlebg2">Vieraat foorumilla</td></tr></table>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr class="titlebg">
<td width="30%">&nbsp;</td>
<td style="width: 14ex;"><a href="' 
$scripturl '?action=who;sort=time'$context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ';asc' '''">'$txt['who_time'], ' '$context['sort_by'] == 'time' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>
<td>'
$txt['who_action'], '</td>
</tr>'
;

// This is used to alternate the color of the background.
$alternate true;

// For every member display their name, time and action (and more for admin).
foreach ($context['members'] as $member)
{
// $alternate will either be true or false.  If it's true, use "windowbg2" and otherwise use "windowbg".
echo '
<tr class="windowbg'
$alternate '2' '''">
<td>'
;
if (
$member['id'] != 0)
   continue;

// Guests don't have information like icq, msn, y!, and aim... and they can't be messaged.
if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
'
$context['can_send_pm'] ? '<a href="' $member['online']['href'] . '" title="' $member['online']['label'] . '">' ''$settings['use_image_buttons'] ? '<img src="' $member['online']['image_href'] . '" alt="' $member['online']['text'] . '" border="0" align="middle" />' $member['online']['text'], $context['can_send_pm'] ? '</a>' '''
'
$member['icq']['link'], ' '$member['msn']['link'], ' '$member['yim']['link'], ' '$member['aim']['link'], '
</div>'
;
}

echo '
<span'
$member['is_hidden'] ? ' style="font-style: italic;"' '''>'$member['is_guest'] ? $member['name'] : '<a href="' $member['href'] . '" title="' $txt[92] . ' ' $member['name'] . '"' . (empty($member['color']) ? '' ' style="color: ' $member['color'] . '"') . '>' $member['name'] . '</a>''</span>';

if (!empty($member['ip']))
echo '
(<a href="' 
$scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank">' $member['ip'] . '</a>)';

echo '
</td>
<td nowrap="nowrap">'
$member['time'], '</td>
<td>'
$member['action'], '</td>
</tr>'
;

// Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
$alternate = !$alternate;
}
echo '
</table>'
;
}

?>


Why this prints this:

<clip>
<td nowrap="nowrap">17:08:59</td>
<td>Kirjautuu sis&auml;&auml;n foorumille.</td>
</tr>


<tr class="windowbg">
<td>
<tr class="windowbg">
<td>
<tr class="windowbg">
<td>
<tr class="windowbg">
<td>
</clip>

This is basic html, but i dont get it   :o
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

[Unknown]

Try:

<?php

// The only template in the file.
function template_main()
{
global $context$settings$options$scripturl$txt;

// Display the table header and linktree.
echo '
<div style="padding: 3px;">'
theme_linktree(), '</div>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr>
<td class="titlebg2">Jäsenet foorumilla</td></tr></table>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr class="titlebg">
<td width="30%"><a href="' 
$scripturl '?action=who;sort=user'$context['sort_direction'] == 'down' && $context['sort_by'] == 'user' ';asc' '''">'$txt['who_user'], ' '$context['sort_by'] == 'user' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>
<td style="width: 14ex;"><a href="' 
$scripturl '?action=who;sort=time'$context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ';asc' '''">'$txt['who_time'], ' '$context['sort_by'] == 'time' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>
<td>'
$txt['who_action'], '</td>
</tr>'
;

// This is used to alternate the color of the background.
$alternate true;

// For every member display their name, time and action (and more for admin).
foreach ($context['members'] as $member)
{
// Skip anyone who is a guest.
if ($member['id'] == 0)
   continue;

// $alternate will either be true or false.  If it's true, use "windowbg2" and otherwise use "windowbg".
echo '
<tr class="windowbg'
$alternate '2' '''">
<td>'
;

// Guests don't have information like icq, msn, y!, and aim... and they can't be messaged.
if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
'
$context['can_send_pm'] ? '<a href="' $member['online']['href'] . '" title="' $member['online']['label'] . '">' ''$settings['use_image_buttons'] ? '<img src="' $member['online']['image_href'] . '" alt="' $member['online']['text'] . '" border="0" align="middle" />' $member['online']['text'], $context['can_send_pm'] ? '</a>' '''
'
$member['icq']['link'], ' '$member['msn']['link'], ' '$member['yim']['link'], ' '$member['aim']['link'], '
</div>'
;
}

echo '
<span'
$member['is_hidden'] ? ' style="font-style: italic;"' '''>'$member['is_guest'] ? $member['name'] : '<a href="' $member['href'] . '" title="' $txt[92] . ' ' $member['name'] . '"' . (empty($member['color']) ? '' ' style="color: ' $member['color'] . '"') . '>' $member['name'] . '</a>''</span>';

if (!empty($member['ip']))
echo '
(<a href="' 
$scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank">' $member['ip'] . '</a>)';

echo '
</td>
<td nowrap="nowrap">'
$member['time'], '</td>
<td>'
$member['action'], '</td>
</tr>

'
;

// Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
$alternate = !$alternate;
}
echo '
</table><br>
//visitors start here
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr>
<td class="titlebg2">Vieraat foorumilla</td></tr></table>
<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">
<tr class="titlebg">
<td width="30%">&nbsp;</td>
<td style="width: 14ex;"><a href="' 
$scripturl '?action=who;sort=time'$context['sort_direction'] == 'down' && $context['sort_by'] == 'time' ';asc' '''">'$txt['who_time'], ' '$context['sort_by'] == 'time' '<img src="' $settings['images_url'] . '/sort_' $context['sort_direction'] . '.gif" alt="" border="0" />' '''</a></td>
<td>'
$txt['who_action'], '</td>
</tr>'
;

// This is used to alternate the color of the background.
$alternate true;

// For every member display their name, time and action (and more for admin).
foreach ($context['members'] as $member)
{
// Skip anyone who is not a guest.
if ($member['id'] != 0)
   continue;

// $alternate will either be true or false.  If it's true, use "windowbg2" and otherwise use "windowbg".
echo '
<tr class="windowbg'
$alternate '2' '''">
<td>'
;

// Guests don't have information like icq, msn, y!, and aim... and they can't be messaged.
if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
'
$context['can_send_pm'] ? '<a href="' $member['online']['href'] . '" title="' $member['online']['label'] . '">' ''$settings['use_image_buttons'] ? '<img src="' $member['online']['image_href'] . '" alt="' $member['online']['text'] . '" border="0" align="middle" />' $member['online']['text'], $context['can_send_pm'] ? '</a>' '''
'
$member['icq']['link'], ' '$member['msn']['link'], ' '$member['yim']['link'], ' '$member['aim']['link'], '
</div>'
;
}

echo '
<span'
$member['is_hidden'] ? ' style="font-style: italic;"' '''>'$member['is_guest'] ? $member['name'] : '<a href="' $member['href'] . '" title="' $txt[92] . ' ' $member['name'] . '"' . (empty($member['color']) ? '' ' style="color: ' $member['color'] . '"') . '>' $member['name'] . '</a>''</span>';

if (!empty($member['ip']))
echo '
(<a href="' 
$scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank">' $member['ip'] . '</a>)';

echo '
</td>
<td nowrap="nowrap">'
$member['time'], '</td>
<td>'
$member['action'], '</td>
</tr>'
;

// Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)
$alternate = !$alternate;
}
echo '
</table>'
;
}

?>


-[Unknown]

Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

Advertisement: