Setting What a User is "doing" when using SSI

Started by themortalgod, August 22, 2007, 04:15:11 PM

Previous topic - Next topic

themortalgod

Ok so i have a site that has intigrated the SMF login system throughout using the SSI.php commands, but when i go into the "whose online" page is says unknown action whenever a user is using a page I created outside the forum itself, is there anyway for me to set a variable on those pages that will send correct information to the whose online pages? for example if they are in the gallery, i set the var to say "viewing gallery" and then if i click on the whose online list when a user is viewing the gallery it displays "viewing gallery" under action.
thx for any help

ExcalibursZone

Not with SSI.php, you cannot do that. Keep in mind that SSI is not an API per se.

You want the smf_api.php file (do a search for smf_api 1.1) for this function:

void smf_logOnline(string action = $_GET['action'])
- logs the currently authenticated user or guest as online.
- may not always log, because it delays logging if at all possible.
- uses the action specified as the action in the log, a good example
  would be "coppermine" or similar.
- you can add entries to the Modifications language files so as to
  make this action show up properly on Who's Online - see Who.php for
  more details.

Which will do what you want. Also look at the Who.php file in Sources for the rest of what you'd need to do.

Ensiferous

with smf_logOnline you need to create language strings with the information otherwise it will give you unknown action. Personally I prefer doing something like this:

FIND: $data[$k] = $txt['who_unknown'];
REPLACE WITH: $data[$k] = $actions['action']; //$txt['who_unknown'];


This means that if it can't find the language string it will set it to whatever string you supplied. It's NOT sanitized so make sure you don't accept user input.
My Latest Blog Post: Debugging Nginx Errors

JovanT

You can try something like this:

$_GET['action'] = 'custom_action';
writeLog();


and then, in Modifications.english.php add something like:

$txt['whoall_custom_action'] = 'This is my custom action;

themortalgod

cool, thx for all the options guys, im loving that API :D

Advertisement: