Skip to main content
Topic: Strange behaviour with "who's online" (Read 2215 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Strange behaviour with "who's online"

Not sure if it's a bug: "Who's online" says user A is visiting his profile. I klick on the link to his profile, and there it says user A is looking at my profile. Going back to "Who's online": User A ist visiting his profile. Going to his profile it says he's looking at my profile. :o

Re: Strange behaviour with "who's online"

Reply #1

Not easy to solve... well, it could be easy to workaround, there is to add a bit to the url in the menu array (and maybe other places), but it would just be a way to "trick" the system a bit more, not to really solve the problem.

The action a user is doing is determined by the last url he visited.
In the case you are describing, User A is visiting the url:
Code: [Select]
http://www.elkarte.net/community/index.php?action=profile
When User B visits User A's profile, Elk finds the URL above in the log and starts trying to understand what the user is doing.
Normally, if Elk finds the bit: "u=123", then it's able to identify that User B is watching the profile of the user with id "123", but in that case, there is no "u" param in the url, so Elk thinks "without the u-bits, the user is watching his own profile".

To fix the problem it would be necessary to check if the current user is the owner of the profile, maybe change in Who.subs.php:
Code: [Select]
				// Whose?  Their own?
if (empty($actions['u']))
$actions['u'] = $url[1];
to
Code: [Select]
				// Whose?  Their own?
if (empty($actions['u']))
{
$memID = currentMemberID();
if ($memID == $user_info['id'])
$actions['u'] = $url[1];
else
$actions['u'] = $memID;
}
could work... maybe, not tested at all.
Bugs creator.
Features destroyer.
Template killer.

Re: Strange behaviour with "who's online"

Reply #2

I think thats a good idea, tried it and its not quite right though?   Humm maybe it is, now I'm confused who I'm looking at :P  Do need to include profile.subs
Last Edit: July 14, 2014, 10:02:59 am by Spuds

Re: Strange behaviour with "who's online"

Reply #3

Guessed so... lol
Bugs creator.
Features destroyer.
Template killer.

Re: Strange behaviour with "who's online"

Reply #4

Did we want to add this in for RC2 ?

Re: Strange behaviour with "who's online"

Reply #5

It's a bit of a shot in the dark, but if you trust that code...
Last Edit: July 19, 2014, 09:05:54 am by emanuele
Bugs creator.
Features destroyer.
Template killer.

 

Re: Strange behaviour with "who's online"

Reply #6

Shot in the dark added ...