Advertisement:

Author Topic: who.template.php  (Read 4690 times)

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
who.template.php
« on: June 10, 2004, 01:17:25 PM »
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.
« Last Edit: June 10, 2004, 01:34:04 PM by 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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: who.template.php
« Reply #1 on: June 10, 2004, 03:31:25 PM »
Just check the ['id'].  If it's 0, don't show it.

-[Unknown]

Offline Oldiesmann

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,868
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • https://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: who.template.php
« Reply #2 on: June 10, 2004, 05:35:41 PM »
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
Cincy Space - now open!

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: who.template.php
« Reply #3 on: June 10, 2004, 05:42:45 PM »
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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: who.template.php
« Reply #4 on: June 11, 2004, 02:51:41 AM »
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]

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: who.template.php
« Reply #5 on: June 11, 2004, 08:36:05 AM »
Hey! Perfect! Thanks!  :D
« Last Edit: June 11, 2004, 08:38:02 AM by 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

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: who.template.php
« Reply #6 on: June 11, 2004, 10:24:37 AM »
Hmmm, current code:

Code: [Select]
<?php

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

// Display the table header and linktree.
echo &#39;
<div style="padding: 3px;">&#39;, theme_linktree(), &#39;</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="&#39; . $scripturl . &#39;?action=who;sort=user&#39;, $context[&#39;sort_direction&#39;] == &#39;down&#39; && $context[&#39;sort_by&#39;] == &#39;user&#39; ? &#39;;asc&#39; : &#39;&#39;, &#39;">&#39;, $txt[&#39;who_user&#39;], &#39; &#39;, $context[&#39;sort_by&#39;] == &#39;user&#39; ? &#39;<img src="&#39; . $settings[&#39;images_url&#39;] . &#39;/sort_&#39; . $context[&#39;sort_direction&#39;] . &#39;.gif" alt="" border="0" />&#39; : &#39;&#39;, &#39;</a></td>
<td style="width: 14ex;"><a href="&#39; . $scripturl . &#39;?action=who;sort=time&#39;, $context[&#39;sort_direction&#39;] == &#39;down&#39; && $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;;asc&#39; : &#39;&#39;, &#39;">&#39;, $txt[&#39;who_time&#39;], &#39; &#39;, $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;<img src="&#39; . $settings[&#39;images_url&#39;] . &#39;/sort_&#39; . $context[&#39;sort_direction&#39;] . &#39;.gif" alt="" border="0" />&#39; : &#39;&#39;, &#39;</a></td>
<td>&#39;, $txt[&#39;who_action&#39;], &#39;</td>
</tr>&#39;;

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

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

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

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

&#39;;

// Switch alternate to whatever it wasn&#39;t this time. (true -> false -> true -> false, etc.)
$alternate = !$alternate;
}
echo &#39;
</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="&#39; . $scripturl . &#39;?action=who;sort=time&#39;, $context[&#39;sort_direction&#39;] == &#39;down&#39; && $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;;asc&#39; : &#39;&#39;, &#39;">&#39;, $txt[&#39;who_time&#39;], &#39; &#39;, $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;<img src="&#39; . $settings[&#39;images_url&#39;] . &#39;/sort_&#39; . $context[&#39;sort_direction&#39;] . &#39;.gif" alt="" border="0" />&#39; : &#39;&#39;, &#39;</a></td>
<td>&#39;, $txt[&#39;who_action&#39;], &#39;</td>
</tr>&#39;;

// 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[&#39;members&#39;] as $member)
{
// $alternate will either be true or false.  If it&#39;s true, use "windowbg2" and otherwise use "windowbg".
echo &#39;
<tr class="windowbg&#39;, $alternate ? &#39;2&#39; : &#39;&#39;, &#39;">
<td>&#39;;
if ($member[&#39;id&#39;] != 0)
   continue;

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

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

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

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

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

?>

Why this prints this:

<clip>
Code: [Select]
<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

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: who.template.php
« Reply #7 on: June 11, 2004, 11:52:41 AM »
Try:

Code: [Select]
<?php

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

// Display the table header and linktree.
echo &#39;
<div style="padding: 3px;">&#39;, theme_linktree(), &#39;</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="&#39; . $scripturl . &#39;?action=who;sort=user&#39;, $context[&#39;sort_direction&#39;] == &#39;down&#39; && $context[&#39;sort_by&#39;] == &#39;user&#39; ? &#39;;asc&#39; : &#39;&#39;, &#39;">&#39;, $txt[&#39;who_user&#39;], &#39; &#39;, $context[&#39;sort_by&#39;] == &#39;user&#39; ? &#39;<img src="&#39; . $settings[&#39;images_url&#39;] . &#39;/sort_&#39; . $context[&#39;sort_direction&#39;] . &#39;.gif" alt="" border="0" />&#39; : &#39;&#39;, &#39;</a></td>
<td style="width: 14ex;"><a href="&#39; . $scripturl . &#39;?action=who;sort=time&#39;, $context[&#39;sort_direction&#39;] == &#39;down&#39; && $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;;asc&#39; : &#39;&#39;, &#39;">&#39;, $txt[&#39;who_time&#39;], &#39; &#39;, $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;<img src="&#39; . $settings[&#39;images_url&#39;] . &#39;/sort_&#39; . $context[&#39;sort_direction&#39;] . &#39;.gif" alt="" border="0" />&#39; : &#39;&#39;, &#39;</a></td>
<td>&#39;, $txt[&#39;who_action&#39;], &#39;</td>
</tr>&#39;;

// 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[&#39;members&#39;] as $member)
{
// Skip anyone who is a guest.
if ($member[&#39;id&#39;] == 0)
   
continue;

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

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

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

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

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

&#39;;

// Switch alternate to whatever it wasn&#39;t this time. (true -> false -> true -> false, etc.)
$alternate = !$alternate;
}
echo &#39;
</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="&#39; . $scripturl . &#39;?action=who;sort=time&#39;, $context[&#39;sort_direction&#39;] == &#39;down&#39; && $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;;asc&#39; : &#39;&#39;, &#39;">&#39;, $txt[&#39;who_time&#39;], &#39; &#39;, $context[&#39;sort_by&#39;] == &#39;time&#39; ? &#39;<img src="&#39; . $settings[&#39;images_url&#39;] . &#39;/sort_&#39; . $context[&#39;sort_direction&#39;] . &#39;.gif" alt="" border="0" />&#39; : &#39;&#39;, &#39;</a></td>
<td>&#39;, $txt[&#39;who_action&#39;], &#39;</td>
</tr>&#39;;

// 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[&#39;members&#39;] as $member)
{
// Skip anyone who is not a guest.
if ($member[&#39;id&#39;] != 0)
   
continue;

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

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

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

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

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

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

?>

-[Unknown]

Offline Owdy

  • SMF Fossil
  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,627
  • Gender: Male
  • W00t!
    • janoloferiksson on LinkedIn
    • @@jaoler on Twitter
Re: who.template.php
« Reply #8 on: June 11, 2004, 11:57:42 AM »
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