Advertisement:

Author Topic: [TRICK] displaying the "unknown action" in the who's online list  (Read 20050 times)

Offline Kindred

  • Support Specialist
  • SMF Master
  • *
  • Posts: 31,416
  • Gender: Male
    • wagner999 on Facebook
    • @Kindred_999 on Twitter
so, you have a bunch of mods installed and 90% of them - while they add functionality to your forum - don't add themselves into the list of valid actions in the Who's Online list.

This little trick won't fix ALL of the problems (it's a quick trick, it doesn't drill down into special actions or sub-actions) but it will, at least, display where the user actually IS in your system.

Code: (find in Sources/Who.php) [Select]
function determineActions($urls, $preferred_prefix = false)
{
  global $txt, $user_info, $modSettings, $smcFunc, $context;

Code: (add after) [Select]
global $scripturl;

Code: (find in Sources/who.php) [Select]
// Unlisted or unknown action.
else
$data[$k] = $txt['who_unknown'];

Code: (replace) [Select]
// Unlisted or unknown action.
else
$data[$k] = $txt['who_thisaction'] . '<a href="' . $scripturl . '?action=' . $actions['action'] . '">' . $actions['action'] . '</a>';

then add the following text string to modifications.YOURLANGUAGE.txt
Code: [Select]
$txt['who_thisaction'] = 'Viewing the ';
« Last Edit: June 25, 2012, 11:45:12 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • Support Specialist
  • SMF Master
  • *
  • Posts: 31,416
  • Gender: Male
    • wagner999 on Facebook
    • @Kindred_999 on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #1 on: January 30, 2012, 10:24:48 PM »
note: I have been playing with the following, but it doesn't quite work....

Code: [Select]
// Unlisted or unknown action.
else {
if (isset($actions['sa'])) {
$extraaction['sa']['text'] = ' - ' . $actions['sa'];
$extraaction['sa']['url'] = ';sa=' . $actions['sa'];
} else {
$extraaction['sa']['text'] = '';
$extraaction['sa']['url'] = '';
}
if (isset($actions['area'])) {
$extraaction['area']['text'] = ' - ' . $actions['area'];
$extraaction['area']['url'] = ';area=' . $actions['area'];
} else {
$extraaction['area']['text'] = '';
$extraaction['area']['url'] = '';
}
if (isset($actions['u'])) {
$extraaction['u']['text'] = ' for User ID' . $actions['u'];
$extraaction['u']['url'] = ';u=' . $actions['u'];
} else {
$extraaction['u']['text'] = '';
$extraaction['u']['url'] = '';
}
if (isset($actions['cat'])) {
$extraaction['cat']['text'] = ' in Category' . $actions['cat'];
$extraaction['cat']['url'] = ';cat=' . $actions['cat'];
} else {
$extraaction['cat']['text'] = '';
$extraaction['cat']['url'] = '';
}

$data[$k] =  'Viewing the <a href="' . $scripturl . '?action=' . $actions['action'] . $extraaction['sa']['url'] . $extraaction['area']['url'] . $extraaction['u']['url'] . $extraaction['cat']['url'] .'">' . $actions['action'] . $extraaction['sa']['text'] . $extraaction['area']['text'] . $extraaction['u']['text'] . $extraaction['cat']['text'] . '</a>';
}

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Labradoodle-360

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,470
  • Gender: Male
    • matthew.kerle on Facebook
    • @matthew_kerle on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #2 on: January 30, 2012, 11:34:55 PM »
Very neat, Kindred...it'd be cool if eventually SMF had this implemented into the core so modifications didn't HAVE to.

The quality of the responses received is directly proportional to the quality of the question asked. | My Modifications

Offline nza2k

  • Jr. Member
  • **
  • Posts: 231
  • Thank you SMF
    • Annuaire Voyage-Net.com
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #3 on: January 31, 2012, 02:41:41 AM »
Thank you Kindred,

Is there any way, without killing the sever, to display real time stats instead of a list of names.

For instance :
- 5 members and 1 moderator are watching post 1
- 7 members are watching post 2
- 3 members are connecting
- 1 member is posting a new message
...

?
« Last Edit: February 02, 2012, 01:36:52 PM by nza2k »
Avis sur les voyagistes dans le forum de Voyage-Net - Cherche un mod pour ajouter des commentaires sur des pages spécifiques comme Center Parc ou Eurodisney avec gestion des éditions, des modérations, des bannissements...

Offline Kindred

  • Support Specialist
  • SMF Master
  • *
  • Posts: 31,416
  • Gender: Male
    • wagner999 on Facebook
    • @Kindred_999 on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #4 on: January 31, 2012, 07:45:38 AM »
that would require a whole bunch more recoding...   my trick is just to replace the frustrating "unknown action"
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline nza2k

  • Jr. Member
  • **
  • Posts: 231
  • Thank you SMF
    • Annuaire Voyage-Net.com
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #5 on: February 02, 2012, 01:37:30 PM »
No problem, I understand. Thank you for your reply
Avis sur les voyagistes dans le forum de Voyage-Net - Cherche un mod pour ajouter des commentaires sur des pages spécifiques comme Center Parc ou Eurodisney avec gestion des éditions, des modérations, des bannissements...

Offline Kindred

  • Support Specialist
  • SMF Master
  • *
  • Posts: 31,416
  • Gender: Male
    • wagner999 on Facebook
    • @Kindred_999 on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #6 on: February 20, 2012, 01:16:40 AM »
note:  I just discovered that you also should add $scripturl to the global variables at the start of the function.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline geek_andy

  • Semi-Newbie
  • *
  • Posts: 23
  • Gender: Male
    • @geek_andy on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #7 on: February 20, 2012, 08:58:37 AM »
Very neat, Kindred...it'd be cool if eventually SMF had this implemented into the core so modifications didn't HAVE to.

I completely agree.

Works great Kindred! Thanks!

Offline ChalkCat

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,411
  • Gender: Female
  • Forum Tea Maker - go on have a cuppa!
    • ChalkCat
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #8 on: March 16, 2012, 02:24:16 PM »
Thank you lots for this  :D

Offline lets4410

  • Newbie
  • *
  • Posts: 1
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #9 on: April 05, 2012, 09:43:55 AM »
just the info I needed, thanks

Offline TattooLeashed

  • Full Member
  • ***
  • Posts: 587
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #10 on: April 05, 2012, 02:08:07 PM »
It doesn't work for me :(


Offline Yoshi

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,151
  • Gender: Male
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #11 on: April 05, 2012, 02:45:15 PM »
It doesn't work for me :(


You just posted it did ???
My Mods / [WIP] Mod Builder / GitHub profile / "A programmer is just a tool which converts caffeine into code."
Quote
<FLAMER> Marketing is about to get into drug activities maybe... but we will see about that later on :P
<Yoshi2889> We're getting free drugs?
<CoreISP> He's talking about caffeine man, damn pen lifter.

Offline TattooLeashed

  • Full Member
  • ***
  • Posts: 587
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #12 on: April 05, 2012, 03:19:15 PM »
Only the word 'Portal' is seen now by the members. Guests show the proper things. Strange...

Offline Kindred

  • Support Specialist
  • SMF Master
  • *
  • Posts: 31,416
  • Gender: Male
    • wagner999 on Facebook
    • @Kindred_999 on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #13 on: April 05, 2012, 04:02:52 PM »
which code snippet did you use?   And did you make exactly the edit that I showed?
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Yoshi

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,151
  • Gender: Male
My Mods / [WIP] Mod Builder / GitHub profile / "A programmer is just a tool which converts caffeine into code."
Quote
<FLAMER> Marketing is about to get into drug activities maybe... but we will see about that later on :P
<Yoshi2889> We're getting free drugs?
<CoreISP> He's talking about caffeine man, damn pen lifter.

Offline Kindred

  • Support Specialist
  • SMF Master
  • *
  • Posts: 31,416
  • Gender: Male
    • wagner999 on Facebook
    • @Kindred_999 on Twitter
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #15 on: April 05, 2012, 04:08:43 PM »
ah yes...   I didn't even think to $txt the english string (naughty me!)

Sorry, my dutch is non existent, so I can't comment directly. lol....
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Yoshi

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,151
  • Gender: Male
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #16 on: April 05, 2012, 04:11:49 PM »
ah yes...   I didn't even think to $txt the english string (naughty me!)

Sorry, my dutch is non existent, so I can't comment directly. lol....
First code's what needs to be added in Modifications.{language}.php, second and third code is Find > Replace.
My Mods / [WIP] Mod Builder / GitHub profile / "A programmer is just a tool which converts caffeine into code."
Quote
<FLAMER> Marketing is about to get into drug activities maybe... but we will see about that later on :P
<Yoshi2889> We're getting free drugs?
<CoreISP> He's talking about caffeine man, damn pen lifter.

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 22,052
  • Master of BBC Abuse
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #17 on: April 05, 2012, 04:17:37 PM »
Nifty. I like it. Should be default IMO.

What I would also like is a change in that silly "Nothing, or nothing you can see" message. It would make more sense to say "Ant is messing around in admin" or something like that, if it is the case, rather than getting all spooky about it.
"My idea of heaven consists of all the things I would go to Hell for."

I need another coding language like I need tertiary syphilis.

Antechinus modzRantyheinous themez - PSD pack for 2.0.x default theme

Offline TattooLeashed

  • Full Member
  • ***
  • Posts: 587
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #18 on: April 08, 2012, 10:22:59 AM »
I did all that Yoshi but it still doesn't work :(


This is how it looks like in who.php:


Code: [Select]
// Unlisted or unknown action.
else {
if (isset($actions['sa'])) {
$extraaction['sa']['text'] = ' - ' . $actions['sa'];
$extraaction['sa']['url'] = ';sa=' . $actions['sa'];
} else {
$extraaction['sa']['text'] = '';
$extraaction['sa']['url'] = '';
}
if (isset($actions['area'])) {
$extraaction['area']['text'] = ' - ' . $actions['area'];
$extraaction['area']['url'] = ';area=' . $actions['area'];
} else {
$extraaction['area']['text'] = '';
$extraaction['area']['url'] = '';
}
if (isset($actions['u'])) {
$extraaction['u']['text'] = ' for User ID' . $actions['u'];
$extraaction['u']['url'] = ';u=' . $actions['u'];
} else {
$extraaction['u']['text'] = '';
$extraaction['u']['url'] = '';
}
if (isset($actions['cat'])) {
$extraaction['cat']['text'] = ' in Category' . $actions['cat'];
$extraaction['cat']['url'] = ';cat=' . $actions['cat'];
} else {
$extraaction['cat']['text'] = '';
$extraaction['cat']['url'] = '';
}

$data[$k] = $txt['unknown_action_viewing'] . ' <a href="' . $scripturl . '?action=' . $actions['action'] . '">' . $actions['action'] . '</a>';
}[s][/s] 

And I put the txt line in my modifications.dutch.php file. What am i doing wrong? Starts to bug me ;)
« Last Edit: April 08, 2012, 10:32:12 AM by TattooLeashed »

Offline Yoshi

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,151
  • Gender: Male
Re: [TRICK] displaying the "unknown action" in the who's online list
« Reply #19 on: April 08, 2012, 10:33:35 AM »
That's the code that doesn't work ;)

Just use the code I provided, it's in the first post of this topic.
My Mods / [WIP] Mod Builder / GitHub profile / "A programmer is just a tool which converts caffeine into code."
Quote
<FLAMER> Marketing is about to get into drug activities maybe... but we will see about that later on :P
<Yoshi2889> We're getting free drugs?
<CoreISP> He's talking about caffeine man, damn pen lifter.