Custom Who.template.php - separated list for users, guests and spiders

Started by Owdy, November 03, 2004, 01:15:56 PM

Previous topic - Next topic

ramystyle

I have replaced my Who.template.php which is located at : Themes/default/  (since I'm using default theme)..

I even tried replacing the file with the code Pedja provided on Page 4 of this thread... N o t h i n g :(

All my files are there..   :-\

Also if I go to  index.php?action=who I get:
An Error Has Occurred!
You cannot access Who's Online right now because it is disabled.


And all my Permissions are set to "View Googlebot & Spiders" !

Could it be conflicting with another bot ? :(


ramystyle

Ahhhhhhhhhhhhhhhh

It works :D

Thanks :D

Niteblade

affiliate blog

MoreBloodWine

Quote from: nite0859 on December 03, 2006, 10:16:54 PM
Quick question ... is this going to work for v1.1 final ?
It should bec I dont believe the who.template.php file changed at al from 1.1 RC3 to 1.1 final... but I could be wrong...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Witte

Yep, mines working fine on 1,1 final with a custom theme...very little modification of the themes files, and no errors whatsoever...great job!!!

ShopHRM

forgive my stupid question, but what does this do that the googlebot mod doesnt? with that mod i see who is a spider/bot seperate from the users and guests. Isnt this the same thing?


Niteblade

Quote from: Pedja on October 10, 2006, 04:05:40 PM
One more update. Several more crawlers are added to the list and also template changed to show resolved mnemoninc address together with IP.

Just replace old Who.template.php with this one.




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

$brokendown = array (

'Members' => array(),

'Guests' => array(),

'Spiders' => array(),

);



foreach($context['members'] AS $key => $member)

{

$spider getAgent($member['query']['USER_AGENT'], $context['members'][$key]['name'], $agent$member['id'] == 0);

$context['members'][$key]['agent'] = $agent;

$member['query']['USER_AGENT'] = isset($member['query']['USER_AGENT']) ? $member['query']['USER_AGENT'] : '';

if ( $member['id'] != )

$brokendown['Members'][] = &$context['members'][$key];

else if ( $spider )

$brokendown['Spiders'][] = &$context['members'][$key];

else

$brokendown['Guests'][] = &$context['members'][$key];

}

// echo '<pre>'; print_r($brokendown['Spiders']); echo '</pre>'; return;

foreach($brokendown AS $group => $members)

{

echo '

<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder">

<tr>

<td class="catbg">'
$group'</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 ($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>'
;



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

echo '

</td>

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

<td>'
$member['action'], '</td>

</tr>'
;
   if ( !empty($member['ip']) ) {
                echo 
'<tr class="windowbg'$alternate '2' '''"><td colspan="3">';
    
echo '<span class="smalltext">';
echo '<b><a href="' $scripturl '?action=trackip;searchip=' $member['ip'] . '" target="_blank" title="' $member['ip'] . '" class="smalltext2">' $member['ip'] . '</a></b> (' host_from_ip($member['ip'])  . '), <acronym title="' $member['query']['USER_AGENT'] . '">' $member['agent'] . '</acronym>';
 
echo '<br /> User agent: ' $member['query']['USER_AGENT']; 

                echo 
'</span>';
                echo 
'</td></tr>';

                 }

// Switch alternate to whatever it wasn't this time. (true -> false -> true -> false, etc.)

$alternate = !$alternate;

}

echo '</table><br/>';

}

echo '

<table cellpadding="3" cellspacing="0" border="0" width="100%" class="tborder"><tr><td class="titlebg">

<b>'
$txt[139], ':</b> '$context['page_index'], '

</td></tr></table>'
;



}



function 
getAgent( &$user_agent, &$user_name, &$result$guest )

{

$known_agents = array (

                
//Search Spiders

array (

'agent' => 'WISENutbot',

'spidername' => 'Looksmart spider',

                        
'spider' => true,

),

array (

'agent' => 'MSNBot',

'spidername' => 'MSN spider',

'spider' => true,

),

array (

'agent' => 'W3C_Validator',

'spidername' => 'W3C Validaator',

        'spider' => true,

),

array (

'agent' => 'Googlebot-Image',

'spidername' => 'Google-Image Spider',

'spider' => true,

),

array (

'agent' => 'Googlebot',

'spidername' => 'Google spider',

'spider' => true,

),



array (

'agent' => 'Mediapartners-Google',

'spidername' => 'Google AdSense spider',

'spider' => true,

),



                array (

'agent' => 'Openbot',

'spidername' => 'Openfind spider',

'spider' => true,

                ),

array (

'agent' => 'Yahoo! Slurp',

'spidername' => 'Yahoo spider',

'spider' => true,
),



                array (

'agent' => 'FAST-WebCrawler',

'spider' => true,

                ),

                array (

'agent' => 'Wget',

'spider' => true,

                ),

array (

'agent' => 'Ask Jeeves'

'spider' => true,



),

array (

'agent' => 'Speedy Spider',

'spider' => true,



),

array (

'agent' => 'SurveyBot',

'spider' => true,



),

array (

'agent' => 'IBM_Planetwide',

'spider' => true,



),



                array (

'agent' => 'GigaBot',

'spider' => true,



),

array (

'agent' => 'ia_archiver',

'spider' => true,

),

array (

'agent' => 'FAST-WebCrawler',

'spider' => true,



),

array (

'agent' => 'Inktomi Slurp',

                        
'spider' => true,

),

                

                array (

'agent' => 'appie',

'spidername' => 'Walhello spider',

'spider' => true,

),

                array (

'agent' => 'Pogodak.co.yu',

'spidername' => 'Pogodak',

'spider' => true,

),

                array (

'agent' => 'TridentSpider',

'spider' => true,

),


                array (

'agent' => 'ccubee',

'spider' => true,

),

                array (

'agent' => 'Alcohol Search',

'spider' => true,

),

                array (

'agent' => 'Google Wireless Transcoder',

'spider' => true,

),

                array (

'agent' => 'ichiro',
'spidername' => 'Goo Japan / Inktomi robot',
'spider' => true,

),

                array (

'agent' => 'NaverBot',

'spider' => true,

),

 //mobiles

 array (
'agent' => 'Nokia'
 ),
 array (
'agent' => 'Samsung',
 ),
 array (
'agent' => 'Ericsson',
 ),
array (
'agent' => 'Siemens',
 ),
  array (
'agent' => 'Motorola',
),
                
//Browsers

 
array (

'agent' => 'Opera',

),

array (

'agent' => 'Firefox',

),

array (

'agent' => 'Firebird',

),

array (

'agent' => 'Safari'

),

           
array (

'agent' => 'Netscape',

),

array (

'agent' => 'MyIE2'

),

array (

'agent' => 'Konqueror'

),

array (

'agent' => 'Galeon'

),

array (

'agent' => 'KMeleon',

),

                array (

'agent' => 'NG/2.0',

),



                array (

'agent' => 'Gecko',

'name' => 'Mozilla',

         
),

                array (

'agent' => 'MSIE',



                ),

);



foreach( 
$known_agents AS $poss )

if (strpos(strtolower($user_agent), strtolower($poss['agent'])) !== false)

{

if ( $guest && isset($poss['spider']) && $poss['spider'] )

$user_name = isset($poss['spidername']) ? $poss['spidername'] : (isset($poss['name']) ? $poss['name'] : $poss['agent']); 

$result = isset($poss['name']) ? $poss['name'] : $poss['agent']; 

return isset($poss['spider']) && $poss['spider'];

}

$result $user_agent;

return false;

}



?>




Wow. This is cool.

* nite0859 returns to scouring the forum about an old thread about adding Globalopper's flags to the who's online list ..
affiliate blog

GoHuFlame

 :o is very nice, and work with smf 1.1 final  :D and integration con mkportal  :D
this is screen the who is, with count the administration  :D


Niteblade

Ok, does anyone know how to integrate the Country Flags with the Who's Online list ? You know, when you see who's online, you'll see all that information along with the Country of the user online .. I can't find it! And I've been looking.
affiliate blog

SusanTN

I would like for the who list to give priority to Members first then guests then spiders so

show all members first, then show guests, and then spiders

For example I have
223 Spiders, 17 Guests, 7 Users (0 Buddies)  but on the Who's Online it shows

2 members on the first page, 2 Guests, and 56 spiders.

I want it to show as many members as possible if any room then show guests and if any room then show spiders.

Ideas?

nitins60

I just want to insert icon of Browser(user agent) of user n online list? Anyone know how to do it? Thankful, if you provid images :P 

mrselnombre

Quote from: bl968 on December 14, 2006, 12:44:08 AM
I would like for the who list to give priority to Members first then guests then spiders so

show all members first, then show guests, and then spiders

For example I have
223 Spiders, 17 Guests, 7 Users (0 Buddies)  but on the Who's Online it shows

2 members on the first page, 2 Guests, and 56 spiders.

I want it to show as many members as possible if any room then show guests and if any room then show spiders.

Ideas?
i want this too.. members should take priority on the first page
(\__/)
(='.'=)This is Bunny. Copy and paste bunny into your
(")_(")signature to help him gain world domination.
Total Twaddle.

SusanTN

Quote from: Owdy on December 30, 2006, 08:38:25 AM
This topic is about custom who.template.php. So in here, we are talking about this feature: http://www.simplemachines.org/community/index.php?action=who . If you install my file from first post, you will get members first, then guests, and then spiders in own colums.

I know and that's exactly what I am talking about.  I have the custom Who.template.php and my issue was directly regarding that. I will reinstall your template and double check but I am sure my issue will still exist. Here's the issue again. It is confirmed.

I have 178 users online, it breaks down to roughly 10 members, 24 Guests and 144 Spiders

I have Members per page in member list set to 50 (Applies to who's online as well). On the online users list using your Who.template.php file I show

6 Members (missing 4), 12 guests (missing 12) and the 32 spiders. On page 1.

What do I need to do so that the who function shows all online members first, then you can divide the rest of the page up with guests and spiders for all I care. I am primarily interested in what my members are doing anyway....


Gobo


mark7144

I simply want to separate Guests from Members ignoring the whether they are spiders or not. However doing the below doesn't keep all the member activities at the top table, in the next page it has more members and guests. Is there a way to have it so ALL the members are first shown THEN the guests?

Delete:
'Spiders' => array(),

Delete:
  //Search Spiders

array (

'agent' => 'WISENutbot',

'spidername' => 'Looksmart spider',

                        'spider' => true,

),

array (

'agent' => 'MSNBot',

'spidername' => 'MSN spider',

'spider' => true,

),

array (

'agent' => 'W3C_Validator',

'spidername' => 'W3C Validaator',

        'spider' => true,

),

array (

'agent' => 'Googlebot-Image',

'spidername' => 'Google-Image Spider',

'spider' => true,

),

array (

'agent' => 'Googlebot',

'spidername' => 'Google spider',

'spider' => true,

),



array (

'agent' => 'Mediapartners-Google',

'spidername' => 'Google AdSense spider',

'spider' => true,

),



                array (

'agent' => 'Openbot',

'spidername' => 'Openfind spider',

'spider' => true,

                ),

array (

'agent' => 'Yahoo! Slurp',

'spidername' => 'Yahoo spider',

'spider' => true,
),



                array (

'agent' => 'FAST-WebCrawler',

'spider' => true,

                ),

                array (

'agent' => 'Wget',

'spider' => true,

                ),

array (

'agent' => 'Ask Jeeves',

'spider' => true,



),

array (

'agent' => 'Speedy Spider',

'spider' => true,



),

array (

'agent' => 'SurveyBot',

'spider' => true,



),

array (

'agent' => 'IBM_Planetwide',

'spider' => true,



),



                array (

'agent' => 'GigaBot',

'spider' => true,



),

array (

'agent' => 'ia_archiver',

'spider' => true,

),

array (

'agent' => 'FAST-WebCrawler',

'spider' => true,



),

array (

'agent' => 'Inktomi Slurp',

                        'spider' => true,

),

               

                array (

'agent' => 'appie',

'spidername' => 'Walhello spider',

'spider' => true,

),

mark7144

Attached is a screenshot of page1 and page2 of Who's Online... it shows that on page 2 members are still listed yet I want all the members to first be displayed on page 1, then the rest be guests.





Pratt

Quote from: bl968 on December 30, 2006, 04:28:21 PM
What do I need to do so that the who function shows all online members first, then you can divide the rest of the page up with guests and spiders for all I care.
Thats exactly what im looking for, searched the entire topic, but didnt got an answer, hope someone can help us out...  ;)

mark7144

Quote from: Pratt on January 18, 2007, 02:23:02 PM
Quote from: bl968 on December 30, 2006, 04:28:21 PM
What do I need to do so that the who function shows all online members first, then you can divide the rest of the page up with guests and spiders for all I care.
Thats exactly what im looking for, searched the entire topic, but didnt got an answer, hope someone can help us out...  ;)
Exactly what I want as well... please someone figure this out.

Advertisement: