Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: nuva on January 13, 2010, 08:18:03 AM

Title: custom "who's online" - action
Post by: nuva on January 13, 2010, 08:18:03 AM
Is it possible to creat a custom action on the who's online page? I am using a site wich is linked to smf with ssi.php, I also have the following code on my main site:
// Do some logging, unless this is an attachment, avatar, theme option or XML feed.
if (empty($_REQUEST['action']) || !in_array($_REQUEST['action'], array('dlattach', 'jsoption', '.xml', 'xmlhttp', 'verificationcode')))
{
// Log this user as online.
writeLog();

// Track forum statistics and hits...?
if (!empty($modSettings['hitStats']))
trackStats(array('hits' => '+'));
}


So, when a user comes to my main site, the who's online list says:
QuoteViewing the board index


Is there any way to change this?

Thank you,
Nuva ;)
Title: Re: custom "who's online" - action
Post by: Kays on January 13, 2010, 11:00:23 AM
Hi, it's been a while but I think this is how it's done.

Before write_log(); add:


$_REQUEST['action'] = 'this_page';


And then in Who.{language}.php in the languages folder in the default theme add:


$txt['who_this_page'] = 'Viewing this lovely site of mine';

[/code]

Replace this_page in both cases if doing this on more than one page.

Title: Re: custom "who's online" - action
Post by: nuva on January 13, 2010, 11:30:46 AM
It didn't work :-\

It still says "Viewing the board index"

actualy, i don't think it is possible to change a request value...
But don't shout at me if it is possible, 'cause i'm not that good :P
Title: Re: custom "who's online" - action
Post by: Kays on January 13, 2010, 11:40:42 AM
Sorry, like I mentioned, it's been a while. It should be $txt['whoall_xxx']


$txt['whoall_this_page'] = 'Viewing this lovely site of mine';


Also, for 2.0 you need to clear the file cache in the Admin CP when adding language strings.
Title: Re: custom "who's online" - action
Post by: nuva on January 13, 2010, 11:59:01 AM
No need to apologize ;)

But still not working :-\ :P
So i added this to my index.php:
<?php
$_REQUEST
['action'] = 'home';
writeLog();
?>


And this in who.english.php:
$txt['whoall_home'] = 'Viewing the home page.';[/s]






I got it to work:
http://www.simplemachines.org/community/index.php?topic=269651.msg1782097#msg1782097

Thanks for your help kays ^^

Title: Re: custom "who's online" - action
Post by: Kays on January 13, 2010, 12:25:52 PM
Good. :)

I forgot that it should be $_GET['action'], not $_REQUEST['action']

I'll mark this as solved then