• Welcome to Simple Machines Community Forum. Please login or sign up.
December 06, 2021, 12:21:20 PM

News:

SMF 2.1 RC4 has been released! Try it out and help us test! :) Read more.


Grouped Who's Online List

Started by rsw686, April 02, 2008, 10:15:45 PM

Previous topic - Next topic

rsw686

Link to Mod

This modification will group the members, guests, and spiders on the who's online list. It will also show the browser version for those allowed to view IP addresses.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Eliana Tamerin

So basically just a packaged version of the tip/trick? Or did you make any improvements of your own?
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

Darkness_


rsw686

Quote from: Eliana Tamerin on April 02, 2008, 11:54:51 PM
So basically just a packaged version of the tip/trick? Or did you make any improvements of your own?

I wasn't aware of a trick for SMF 2.0.

Quote from: Darkness_ on April 05, 2008, 05:16:49 PM
demo ?

You can view it at my forum http://www.thereptilefile.com/forum/index.php?action=who

Admins can also see the member's IP and browser version.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Apllicmz

thank you she work
fine
i translate portuguese...Pt_PT/pt_BR

<file name="$languagedir/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['whosonline_members'] = 'Membros';
$txt['whosonline_guests'] = 'Visitantes';
$txt['whosonline_spiders'] = 'Spiders';]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['whosonline_members'] = 'Membros';
$txt['whosonline_guests'] = 'Visitantes';
$txt['whosonline_spiders'] = 'Spiders';]]></add>
</operation>
</file>



Duilio




rubensde

Hi.

I tried to integrate that plugin on my 1.1.4 SMF forum, but i cant add .php files to a theme.
On my default theme there is not who.php file and post.php file. Can I add them any way?

Thanks

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

THE BRA1N

Would it be asking too much to add the extended browser info on hover like this version has..

Quote from: Yağız on April 07, 2008, 08:39:06 AM
You can use this tip for 1.1.4
http://www.simplemachines.org/community/index.php?topic=19243.0

Vampy

Can someone kindly help?

I've looked at the parse page for manual install into 1.1.5 and there are several sections where it says to replace things in the ./Themes/default/Who.template.php file that I do not have.

For example:

Where it says to replace </tr>  <tr class="catbg"> with this </tr>'; $show_by = $context['show_by'] == 'all' ? array('members', 'guests', 'spiders') : array($context['show_by']); foreach($show_by as $show) { $count = 0; echo ' <tr class="catbg">

There are several others. I'd like to install this mod but I need help ... please

Thanks in advance

rsw686

Vampy this mod is for SMF 2.0 that is why you don't have those sections.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Vampy

 :P I realised that afterwards - I've applied the other one from  http://www.simplemachines.org/community/index.php?topic=19243.0 and that works fine with 1.1.5

This throws up a question though - why is there a parser for 1.1.5 if it can't be applied?

vagrant

tried it on 2.0 bete4
failed step 2

is there an update available or a simple change to make please.

tk2012

It doesn't say it is compatible with b4.0, but it is working for me.

try replacing it with this line instead:

<td width="30%"><a href="' . $scripturl . '?action=who;start=', $context['start'], ';show=', $context['show_by'], ';sort=user', $context['sort_direction'] != 'down' && $context['sort_by'] == 'user' ? '' : ';asc', '" rel="nofollow">', $txt['whosonline_' . $show], ' ', $context['sort_by'] == 'user' ? '<img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></td>

(Keep in mind that is supposed to be one line the entire way across the page.)

You will have to do the 2nd edit manually yourself.  You won't be able to search for the entire string because the rel="nofollow" code has been added.  The string you want to replace is around line 28 of the file. 

Search for:

<td width="30%">

because there is only one line in the file that contains that and replace the entire line with what I have above and see if that works for you.  Like I said, it is working on my b4.0 forum.


* Someone can reply here if they see that I am incorrect.


carbonize

October 18, 2008, 12:04:04 PM #16 Last Edit: October 18, 2008, 03:38:06 PM by carbonize
I used the instructions for 2.4 and it's working fine but I made some modifications as I prefered the old method of having the useragent as title and I also added support for Chrome, Flock and the iPhone. Also added support for the version number of more browsers. I will detail the changes here but I also zipped mine up and uploaded it to http://carbonize.co.uk/Who.zip

', ($show != 'spiders') ? '<br />' : '', '<span class="smalltext">(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;sa=tracking;area=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>', ($show != 'spiders') ? ', ' . getAgent($member['query']['USER_AGENT']) : '', ')</span>';

I used

', ($show != 'spiders') ? '<br />' : '', '<span class="smalltext">(<a href="' . $scripturl . '?action=', ($member['is_guest'] ? 'trackip' : 'profile;sa=tracking;area=ip;u=' . $member['id']), ';searchip=' . $member['ip'] . '">' . $member['ip'] . '</a>', ($show != 'spiders') ? ', <span title="'. htmlspecialchars($member['query']['USER_AGENT']) . '">' : '', ($show != 'spiders') ? getAgent(htmlspecialchars($member['query']['USER_AGENT'])) : '', '</span>)</span>';

and my array at the end looks like this

$known_agents = array (
// Phones
array ('agent' => 'Nokia'),
array ('agent' => 'Samsung'),
array ('agent' => 'Ericsson'),
array ('agent' => 'Siemens'),
array ('agent' => 'Motorola'),
array ('agent' => 'BlackBerry'),
array ('agent' => 'iPhone'),
// Browsers
array ('agent' => 'Opera', 'version' => '/opera/i'),
array ('agent' => 'Flock', 'version' => '/flock\//i'),
array ('agent' => 'Firefox', 'version' => '/firefox\//i'),
array ('agent' => 'Firebird', 'version' => '/firebird\//i'),
array ('agent' => 'Chrome', 'version' => '/chrome\//i'),
array ('agent' => 'Safari', 'version' => '/safari\//i'),
array ('agent' => 'Google Desktop'),
array ('agent' => 'Netscape', 'version' => '/navigator\//i'),
array ('agent' => 'MyIE2'),
array ('agent' => 'Konqueror'),
array ('agent' => 'Galeon'),
array ('agent' => 'KMeleon', 'version' => '/k-meleon\//i'),
array ('agent' => 'NG/2.0'),
array ('agent' => 'Gecko', 'name' => 'Mozilla'),
array ('agent' => 'MSIE', 'name' => 'IE', 'version' => '/msie/i')
);


Had to put Flock before Firefox as Flock also says Firefox in it's useragent.

Also at the end I just replaced

return $user_agent;
}
?>


with

  $user_agent = (empty($user_agent)) ? 'no useragent' : $user_agent;
return $user_agent;
}
?>


So it displays something for empty useragents.
C a r b o n i z e

carbonize

October 18, 2008, 02:58:59 PM #17 Last Edit: October 18, 2008, 03:25:08 PM by carbonize
Ok further improved the script (in my eyes anyway) by improving Netscape detection and making it show the full version number. So instead of it saying Firefox 3 it will now say Firefox 3.0.3 and so on. Also fixed issue with the multiple ways Opera shows it's version number.

function getAgent ($user_agent)
{
$known_agents = array (
// Phones
array ('agent' => 'Nokia'),
array ('agent' => 'Samsung'),
array ('agent' => 'Ericsson'),
array ('agent' => 'Siemens'),
array ('agent' => 'Motorola'),
array ('agent' => 'BlackBerry'),
array ('agent' => 'iPhone'),
// Browsers
array ('agent' => 'Opera', 'version' => '/opera/i'),
array ('agent' => 'Flock', 'version' => '/flock\//i'),
array ('agent' => 'Firefox', 'version' => '/firefox\//i'),
array ('agent' => 'Firebird', 'version' => '/firebird\//i'),
array ('agent' => 'Chrome', 'version' => '/chrome\//i'),
array ('agent' => 'Safari', 'version' => '/safari\//i'),
array ('agent' => 'Google Desktop'),
array ('agent' => 'Netscape', 'version' => '/netscape\//i'),
array ('agent' => 'Navigator', 'name'=>'Netscape', 'version' => '/navigator\//i'),
array ('agent' => 'MyIE2'),
array ('agent' => 'Konqueror', 'version' => '/konqueror\//i'),
array ('agent' => 'Galeon', 'version' => '/galeon\//i'),
array ('agent' => 'KMeleon', 'version' => '/k-meleon\//i'),
array ('agent' => 'NG/2.0'),
array ('agent' => 'Gecko', 'name' => 'Mozilla'),
array ('agent' => 'MSIE', 'name' => 'IE', 'version' => '/msie/i')
);

foreach($known_agents as $agent)
if (strpos(strtolower($user_agent), strtolower($agent['agent'])) !== false)
{
$browser = isset($agent['name']) ? $agent['name'] : $agent['agent'];
$version = isset($agent['version']) ? preg_split($agent['version'], $user_agent) : false;

    $version = (strpos($version[1], ';') > 0) ? substr($version[1], 0, strpos($version[1], ';')) : $version[1];
    $version = (strpos($version, ' ') > 0) ? substr($version, 0, strpos($version, ' ')) : $version;
    $version = str_replace('/', '', $version);
return $version ? $browser . ' ' . $version : $browser;
}
  $user_agent = (empty($user_agent)) ? 'no useragent' : $user_agent;
return $user_agent;
}
C a r b o n i z e

dwd2000

Very nice.

I am using SimplePortal Classic 2.0.5. I would like to add the "Who's Online" section to a block (php or html) to display on the portal. (SimplePortal version does not show the spiders) I would be making the block visible to only the admin (me)

Any ideas?
30 years ago I was young and foolish.
Now I'm just young.

DAMMIT JIM...I'M A TWEAKER...NOT A CODER!!!

Dave's Games

carbonize

Well there is already the abuility to display who is online via the ssi file of SMF. I'm sure it wouldn't be to compicated for someone to copy portions of this code over to the SSI file.
C a r b o n i z e

Advertisement: