Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Mike Bobbitt on May 24, 2005, 12:47:14 PM

Title: Tracking User Activity
Post by: Mike Bobbitt on May 24, 2005, 12:47:14 PM
I've created a simple script to track recent user activity on SMF. It's nothing fancy, but if you want to find out what people have been up to (useful for keeping tabs on potential trouble) you may find this handy. You can download the files from here: http://army.ca/deleteme/tracker.zip

Installation is simple, just download the zip, unzip it, then drop it in to your SMF directory (same one that contains SSI.php), then browse to tracker.php.

You can enter the username, display name or user ID# for a user to track. Due to the nature of the info provided, currently only forum admins are allowed to run the script.

I've included a couple screen shots to show the general functionality.


Cheers
Mike

Update: Now shows moderator actions as well.

Update [10 July 2009]: A new version for SMF 2 is now available at the above link.

[edited the install instructions to include that it needs to be unzipped first: Shadav]
Title: Re: Tracking User Activity
Post by: Owdy on May 24, 2005, 12:56:39 PM
Nice MOD!

What is function=doesnothing? :D
Title: Re: Tracking User Activity
Post by: Thantos on May 24, 2005, 01:01:02 PM
Since you are including SSI.php anyways why not use
$scripturl instead of $forumurl
and
$db_prefix instead of $accounts_db_name
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on May 24, 2005, 01:17:38 PM
Mike, that's a great idea... can't believe I missed it! Script and instructions have been updated, thanks!

Owdy: I can't find a "doesnothing" reference in the code... did I miss something? :)
Title: Re: Tracking User Activity
Post by: Owdy on May 24, 2005, 01:25:04 PM
Look your attachment ;)
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on May 24, 2005, 01:26:00 PM
Oh, lol...

Well, that works as designed of course... and does nothing! ;)
Title: Re: Tracking User Activity
Post by: Owdy on May 24, 2005, 01:27:44 PM
[offtopic]
What an great function! ;D Are you going to release that mod also? ;)  :D

edit: too late, its released in here allready: http://www.simplemachines.org/community/index.php?function=doesnothing

[/offtopic]
Title: Re: Tracking User Activity
Post by: Han on May 31, 2005, 11:39:58 AM
What a great function, and so easy to install. Tnx for sharing !!
This ought to be a standard tool in a future release of SMS.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on May 31, 2005, 11:47:10 AM
It's not fancy, but I needed something to give me visibility into user actions. Glad you like it! :D
Title: Re: Tracking User Activity
Post by: dustrho on May 31, 2005, 03:58:53 PM
If I may say so, what a kick ass tool!  This is just what I was looking for, and you already made this!  Thanks!!!   :D
Title: Re: Tracking User Activity
Post by: Furvert on June 16, 2005, 12:21:57 AM
I like this function, can it be easily linked into the current user/IP tracker?
So that you can just click on the user name to invoke it instead of using the tracker.php directly.
Of course this should be a admin/mod only function.

I am a newbie with this code set so am somewhat afraid to tinker much so far, but I would suspect this is a simple edit of one file.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on June 16, 2005, 08:30:44 AM
Yeah, that would be pretty easy. You can invoke it for a specific user like this:

http://server.com/tracker.php?function=track;u=[uid]

So all it would take is just adding that URL with the user's ID in the URL, wherever you want to invoke it.
Title: Re: Tracking User Activity
Post by: Furvert on June 16, 2005, 01:28:25 PM
Thanks, I thought it would be simple.
Now I just need to figure out where I want it ;)
Title: Re: Tracking User Activity
Post by: Han on July 07, 2005, 07:38:32 AM
Unfortinately this function does not work anymore in SMF 1.1 Beta 3
It gives me an error and says "Hacking attempt...".  :(

Can it be altered so that it wil work again in SMF 1.1 Beta 3 ??
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on July 07, 2005, 07:46:54 AM
No problem, give it a try now...


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Han on July 10, 2005, 10:09:30 PM
Thank you very much, Mike.
It Works again  :)
Title: Re: Tracking User Activity
Post by: dustrho on July 22, 2005, 09:25:20 AM
I have to reply to this thread again, and just tell you that it is one of the best features an Admin could possibly use for your own forums.  I've used it in a number of occasions now, and I must say that it's great knowing what people are doing (lurkers and spies, oh my!).  Thanks for making this script!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on July 22, 2005, 09:45:38 AM
Thanks Chris, I'm glad you've found it useful. It seemed logical that admins might want to know this type of thing and since the info is already there it was pretty easy to thow together.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Han on July 25, 2005, 06:30:10 PM
It comes in handy in all occasions when the admin needs to know if a user has read a certain topic.
I'm very pleased with it!!
Title: Re: Tracking User Activity
Post by: Skhilled on August 20, 2005, 03:15:51 AM
Forgive me ignorance, but does "just drop it in" means in the smf root directory? You didn't specify which dir.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on August 21, 2005, 08:47:14 PM
You can put it anywhere, so long as the SSI.php path at the top of the file is correct.
Title: Re: Tracking User Activity
Post by: Skhilled on August 22, 2005, 07:48:05 AM
Thanks, Mike. Will give it a try.
Title: Re: Tracking User Activity
Post by: Dem0n on August 31, 2005, 03:51:12 PM
How do you make it so when in the admin center you add a link for admins to click on to track this activity? I think that would be a nice feature.

Title: Re: Tracking User Activity
Post by: Mike Bobbitt on August 31, 2005, 04:55:39 PM
Quote from: Mike Bobbitt on May 24, 2005, 12:47:14 PM
Due to the nature of the info provided, currently only forum admins are allowed to run the script.

Yep. ;)

Edit to answer edited question... :)

I try not to modify any SMF code so there's no maintenance on updated versions, but I imagine it'd be a matter of modifying the right file in your template.
Title: Re: Tracking User Activity
Post by: Dem0n on August 31, 2005, 04:57:28 PM
I edited the other post and i figured that out..lol
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on August 31, 2005, 05:13:40 PM
Yeah, and I blindly replied based on the contents of the notification e-mail, then when I looked, I noticed the question was different. ;)
Title: Re: Tracking User Activity
Post by: Dem0n on August 31, 2005, 08:14:24 PM
Quote from: Mike Bobbitt on August 31, 2005, 04:55:39 PM
Quote from: Mike Bobbitt on May 24, 2005, 12:47:14 PM
Due to the nature of the info provided, currently only forum admins are allowed to run the script.

Yep. ;)

Edit to answer edited question... :)

I try not to modify any SMF code so there's no maintenance on updated versions, but I imagine it'd be a matter of modifying the right file in your template.

Well I know that it would consist of modifying the right files in the template.. But asfar as which to edit, And what part of code to edit, I'm clueless!

Title: Re: Tracking User Activity
Post by: Harelin on September 04, 2005, 02:56:55 AM
I have modified the permissions in tracker.php to allow more groups than just my admins to access the file.  I've given access to a semi-admin member group, so to speak... but this member group does not have access to all boards.

I'd like to limit tracker.php to where it doesn't list the subject of threads in boards he doesn't have access to.  They're of a private nature - by clicking on the link, he's not permitted to read the thread, of course... but I'd like the peace of mind in knowing that the 'semi-admins' can't read the subjects of these threads either.

Is there any way I can exclude certain boards (or just the threads within them) in my forum from being listed on tracker.php?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 04, 2005, 08:16:34 AM
Find this bit:


Quotewhile ($res=mysql_fetch_array($result))
        {
                // Get the topic title
                $result2=db_query("SELECT $db_message_table.`subject` FROM $db_message_table WHERE $db_message_table.`ID_TOPIC` = \"$res[ID_TOPIC]\"",__FILE__, __LINE__);
                $res2=mysql_fetch_array($result2);
                $subject=$res2[0];
                mysql_free_result($result2);

                echo "<tr><td><a href=\"$scripturl/topic,$res[ID_TOPIC].0.html\">$subject</a></td><td>";
                echo date("Y/m/d H:i:s",$res[logTime]);
                echo "</td></tr>\n";
        }

to this:


Quotewhile ($res=mysql_fetch_array($result))
        {
                // Get the topic title
                $result2=db_query("SELECT $db_message_table.`subject`,  $db_message_table.`ID_BOARD` FROM $db_message_table WHERE $db_message_table.`ID_TOPIC` = \"$res[ID_TOPIC]\"",__FILE__, __LINE__);
                $res2=mysql_fetch_array($result2);
                $subject=$res2[0];
                $board=$res2[1];
                mysql_free_result($result2);

                // Check to see if it's an allowed board
                if ($isstaff || ($board != "10" && $board != "19"))
                {
                                echo "<tr><td><a href=\"$scripturl/topic,$res[ID_TOPIC].0.html\">$subject</a></td><td>";
                                echo date("Y/m/d H:i:s",$res[logTime]);
                                echo "</td></tr>\n";
                }

        }

This example excludes boards 10 and 19, but you can easily extend it to more. Not tested, but it should work.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Harelin on September 04, 2005, 02:00:07 PM
Wow, thanks for the quick response.  :)

The code you provided doesn't seem to work, though... nothing seems to have changed and the boards aren't excluded.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 04, 2005, 08:20:16 PM
Try this then, change:

Quoteecho "<tr><td><a href=\"$scripturl/topic,$res[ID_TOPIC].0.html\">$subject</a></td><td>";

to

Quoteecho "<tr><td><a href=\"$scripturl/topic,$res[ID_TOPIC].0.html\">$subject ($board)</a></td><td>";

And see what's in brackets after each topic name. It should be the board ID.
Title: Re: Tracking User Activity
Post by: Harelin on September 04, 2005, 08:31:18 PM
Done and done...

I now see a '(2)' next to every topic name... i.e.

Petrol Prices set to Rise? (2)

When I view someone else's recent usage, I see a different board ID # while again they are all the same no matter the board they belong to.  I have no problem identifying the board ID number, btw, not sure what that latest modification was for.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 04, 2005, 09:21:48 PM
Found an error in the code... replace "$board=$res[1];" with "$board=$res2[1];" and you should have better results.
Title: Re: Tracking User Activity
Post by: Harelin on September 04, 2005, 10:26:57 PM
That fixed the board ID not displaying correctly, but the two boards I'm trying to exclude are still visible.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 04, 2005, 10:29:48 PM
What's your if statement look like? E.G.:

if ($isstaff || ($board != "10" && $board != "19"))

What board IDs are you trying to hide?
Title: Re: Tracking User Activity
Post by: Harelin on September 04, 2005, 10:31:30 PM
Quote from: Mike Bobbitt on September 04, 2005, 10:29:48 PM
What's your if statement look like? E.G.:

if ($isstaff || ($board != "10" && $board != "19"))

What board IDs are you trying to hide?

if ($isstaff || ($board != "8" && $board != "12"))   

Boards 8 and 12.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 04, 2005, 10:33:22 PM
Ok, that all looks good... How is $isstaff set, you mentioned you made some changes there...
Title: Re: Tracking User Activity
Post by: Harelin on September 04, 2005, 10:39:06 PM
Good point.  I just changed it back to default so we're on the same page while troubleshooting.  No difference, though.  Is the code working on your end?

I had it set to "$isstaff=$context['allow_admin'];" which allows both my admin and 'semi-admin' member groups to access it.  It's now back to "$isstaff=$user_info['is_admin'];"
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 07, 2005, 03:19:59 PM
I haven't actually tried the code. :)

But if $board is now being set properly, it should work. Actually, given the way you've coded things you may want to get rid of the $isstaff check:

if ($board != "8" && $board != "12")
Title: Re: Tracking User Activity
Post by: Egg on September 25, 2005, 06:25:50 AM
would this work on 1.1RC1 ??
Title: Re: Tracking User Activity
Post by: Anakin_holland on September 25, 2005, 07:08:10 AM
Just installed it on my board. Works a treat!

Thnx mike!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 25, 2005, 09:02:25 AM
Yep, tested and confirmed on 1.1 RC1. :)
Title: Re: Tracking User Activity
Post by: Egg on September 25, 2005, 12:34:45 PM
just the first package, or with the listed alterations added??

thanks
Title: Re: Tracking User Activity
Post by: Purplemadness on September 25, 2005, 01:31:49 PM
It's cool, works fine on 1.1 RC1
Keep up the good work ;)
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 25, 2005, 07:16:51 PM
Egg, both the original script and the modifications will work on 1.1 RC1.
Title: Re: Tracking User Activity
Post by: Egg on September 26, 2005, 06:22:42 PM
doesnt seem to like it

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /htdocs/200mph.org.uk/tracker.php on line 2

Parse error: parse error, unexpected T_STRING in /htdocs/200mph.org.uk/tracker.php on line 2
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 27, 2005, 12:18:42 PM
Line 2 eh... maybe one of the mods above broke it, or maybe it was FTP'd in as binary...?
Title: Re: Tracking User Activity
Post by: Egg on September 27, 2005, 04:25:36 PM
I took the file from your first post. changed SSI path, and thats the output :(

tried reuploading in ASCII, no change. same error.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 27, 2005, 04:46:03 PM
Ok, line 2 is the require('/var/www/html/forums/SSI.php'); statement, so can you double check the syntax is OK?
Title: Re: Tracking User Activity
Post by: Egg on September 28, 2005, 02:36:28 AM
if the path to my SSI.php is

/htdocs/publicspace/90/200mph.net/smf

or

www.200mph.net/smf

what would the syntax be??

I think my lack of knowledge might be the cause  ::) ???
Title: Re: Tracking User Activity
Post by: Egg on September 28, 2005, 07:38:17 AM
replaced it with

<?php

require(dirname(__FILE__) . '/SSI.php');

?>


and it all works.

thank you!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 28, 2005, 07:59:16 AM
Nice idea, then the files simply have to be in the same directory... no need to update the path. :)
Title: Re: Tracking User Activity
Post by: webfangled on October 21, 2005, 09:13:52 AM
This should be included in the SMF release its very handy!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on October 21, 2005, 10:03:21 AM
Thanks... just updated it. In a nut shell:

* Simpler install (if it's in the same dir as SSI.php no edits required, otherwise you can set the path).

* Current activity is shown in a more readable format.

* Small code cleanups.
Title: Re: Tracking User Activity
Post by: Saku on October 23, 2005, 12:27:50 AM
thanks work like a charm!
i have a question, it's possible to track the members who have download attachements files and how much time??
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on October 23, 2005, 08:02:38 AM
You could check your web logs for that, but as far as I know SMF doesn't track attachment downloads...
Title: Re: Tracking User Activity
Post by: Nitro on October 24, 2005, 03:58:28 PM
Quote from: Harelin on September 04, 2005, 10:39:06 PM
Good point.  I just changed it back to default so we're on the same page while troubleshooting.  No difference, though.  Is the code working on your end?

I had it set to "$isstaff=$context['allow_admin'];" which allows both my admin and 'semi-admin' member groups to access it.  It's now back to "$isstaff=$user_info['is_admin'];"

so this allow_admin actually works?
Title: Re: Tracking User Activity
Post by: brooks on October 26, 2005, 12:39:40 PM
QuoteFatal error: Call to undefined function: determineactions() in /home/thefound/public_html/tracker.php on line 157

any ideas why I'm getting this when the user is logged in?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on October 26, 2005, 12:46:55 PM
What version of SMF are you using? I've tested with 1.1 RC1, but it may not work with other versions... Basically, Who.php in your Source directory must have a determineactions function... If not, just comment out line 157 in the script.
Title: Re: Tracking User Activity
Post by: brooks on October 29, 2005, 03:03:47 PM
1.0.5, and I'll do that, thanks :)
Title: Re: Tracking User Activity
Post by: itsjustme on November 05, 2005, 02:23:51 PM
oh this is cool.

I recently had a user that caused a lot of trouble and could have used this.

can you tell me how to add global mods to the allowed...

Thanks

Dave
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on November 05, 2005, 05:57:31 PM
Try something like this:

$isadmin= 0;

$db_member_table = $db_prefix."members";

// List of all "staff" group IDs
$staffgroup_ids = "1,2";

// Reformat staff IDs into regex
$staffgroups = "(".join("|", split(",", $staffgroup_ids)).")";

$query = "SELECT $db_member_table.ID_GROUP, $db_member_table.additionalGroups FROM $db_member_table WHERE $db_member_table.ID_MEMBER = ".$context['user']['id']."";

$result = db_query($query, __FILE__, __LINE__);

while ($res = mysql_fetch_array($result)) {
$groups = $res['ID_GROUP'];
if ($res['additionalGroups']) {
$groups .= ",".$res['additionalGroups'];
}

$groups = ",$groups,";

// Staff
if (preg_match("/,$staffgroups,/", $groups)) {
$isadmin = 1;
} else {
$isadmin = 0;
}
}
mysql_free_result($result);


Just set $staffgroup_ids to all the group ID #'s that your staff belong to (E.G. 1 for admin, 2 for global mod, etc.)

Hope that hepls.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: blinddruid on November 05, 2005, 08:57:53 PM
Why would I get this error message on some users.

Fatal error: Call to undefined function: determineactions() in /home/sensne2/public_html/forum/tracker.php on line 157

while on other usersit works just fine? 
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on November 05, 2005, 09:14:48 PM
Hmmm, that is weird... The function should always be defined, regardless of the user... You could comment out that line, but then you won't get the "translation" of the user's current action.
Title: Re: Tracking User Activity
Post by: HoTmetal on November 06, 2005, 01:42:32 AM
Quote from: Owdy on May 24, 2005, 01:27:44 PM
[offtopic]
What an great function! ;D Are you going to release that mod also? ;)  :D

edit: too late, its released in here allready: http://www.simplemachines.org/community/index.php?function=doesnothing

[/offtopic]

wow, function=doesnothing that should be a mod within itself....j/k

kewl mod Mike Bobbitt

cant wait for rc1 to come out...
Title: Re: Tracking User Activity
Post by: jrstark on December 19, 2005, 12:33:23 AM
Right now it is showing my server time (GMT).  Can I change it to show my local time?
Title: Re: Tracking User Activity
Post by: zaandammer on December 19, 2005, 01:06:48 PM
It's giving me this error.

d a_#à wÿøÿ÷,,eôìhangelog-themes.txt te downloaden bij 0,00 kp/s, 4032 van 12844 bytes, 00:00:00 sec te gaanA@b,,te/rating_3.gif (337 bytes) DxBË ¸Îl}y{A‡‡('އ–—"+˜–+!;ü»ü»Tè0è00ô7¬èDÀþœûaøU!t\DERROR: You are not Army.ca Staff.

Do you know what I'm doing wrong? I just downloaded tracker.php from your first post, uploaded it to smf dir and gave me this error.

Ronald.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on December 19, 2005, 02:28:53 PM
I'm guessing FTP in binary mode instead of ASCII? But none of that text is even in tracker.php, so that's odd. Do your web server error logs show anything?
Title: Re: Tracking User Activity
Post by: zaandammer on December 19, 2005, 03:10:53 PM
Uploaded it again in ASCII mode and still same prob.
Maybe this'll help. I just moved the forum from one domain to another (same host).
I figured out tracker.php wasn't working well anymore. So I guessed a clean install might help.. Guess not.

Ronald.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on December 19, 2005, 03:12:02 PM
Do you have shell access? If so, try running "php -f tracker.php" to get the base output from it.
Title: Re: Tracking User Activity
Post by: zaandammer on December 19, 2005, 03:15:55 PM
I guess I don't have shell access as I don't know what it is. By the way, there are no error messages in the server log.

Ronald.
Title: Re: Tracking User Activity
Post by: damacguy on December 29, 2005, 11:31:25 AM
I got this error when I try and go to the tracker (http://myforum/path/tracker.php - same location as my SSI file)

Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /Library/WebServer/Documents/smf/tracker.php on line 107

I look at line 107 and the code that starts there is
// Generate query
$query = "SELECT $db_member_table.`ID_MEMBER` FROM $db_member_table WHERE $db_member_table.`memberName` = \"$user\" OR $db_member_table.`realName` = \"$user\"";
$result = mysql_query($query);
if (!$result) {
die("$query failed: ".mysql_error());


I'm running RC1.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on December 29, 2005, 02:23:34 PM
That's odd... Line 107 is actually the comment, not real code. Is it possible that the file was modified or FTP'd in binary mode so the line breaks aren't correct?
Title: Re: Tracking User Activity
Post by: damacguy on December 29, 2005, 11:16:09 PM
No. I'm reading the file right off the server. It could simply be an issue of BBEdit's numbering the lines, or how php is reporting it.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on December 30, 2005, 08:24:49 AM
Try commenting out lines in that area to see if you can make the error go away. That way you can isolate the actual line that's the problem...
Title: Re: Tracking User Activity
Post by: damacguy on January 02, 2006, 01:02:11 PM
I commented out that entire else statement (from } else { through... the closing } before if (!$u) {) and the error change to line 108.

Huh?   :-\
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 02, 2006, 01:41:18 PM
Seems like maybe an erorr from a runaway { or quote elsewhere in the file maybe. If you can, try re-downloading it without editing anything to see if it runs. Could be that something was changed when you edited the file...
Title: Re: Tracking User Activity
Post by: damacguy on January 02, 2006, 01:54:47 PM
Rats... still no luck (I'm sure it's not an upload problem too). I upgraded to RC2, but had been using RC1 before. That doesn't seem to have made any difference (either way).

Am I missing something to configure? I'll re-read the thread again.
Title: Re: Tracking User Activity
Post by: Dean Williams on January 02, 2006, 04:48:18 PM
there are some bugs in this, for instance the links to the places a visitor has been is wrong.

I have SMF 1.0.5
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 02, 2006, 05:19:44 PM
It was designed to work on 1.1 RC1, so some of the links may not be properly formed for 1.0.5.
Title: Re: Tracking User Activity
Post by: Dean Williams on January 02, 2006, 05:26:42 PM
why are you making it compatible for a version that is in BETA stages? shouldnt everyone be making mods for the current released version which is 1.0.5?

I would use 1.1 but there is no package update yet :(
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 02, 2006, 08:53:32 PM
I'm making it for the version I use, and sharing it in case others find it useful. :)
Title: Re: Tracking User Activity
Post by: fiver on January 04, 2006, 11:42:30 AM
Hi Mike,

Just updated from smf1.1rc1 to rc2 and tracker.php stopped working.

Error log:
Unknown column '******.smf_log_boards.logTime' in 'order clause'
File: /home/fivearts/public_html/tracker.php
Line: 169

I had a look through phpMyAdmin >> smf_log_boards and there is no "logTime" field. But in backup_smf_log_boards there is "logTime" field.

What should I do? Should I change something under tracker.php or something in phpMyAdmin? I have never tweak phpMyAdmin before.

:o
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 04, 2006, 11:57:36 AM
I noticed that myself recently... I've asked about it here (http://www.simplemachines.org/community/index.php?topic=63763.msg440686#msg440686) but no reply yet.

I've updated the script to work with RC2, but unfortunately that means no date/time indicators, which makes it pretty much useless. :( If that info is stored somewhere, I can add it back in.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Han on January 07, 2006, 07:47:24 PM
Hi Mike. We've just updated to RC2 and are also getting the 169 error.
I hope you will get the info to get tracker.php to work again. It's a very useful tool for us.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 07, 2006, 07:56:03 PM
If you re-download the tracker.php script it should work with RC2 but unfortunately no time/date stamps. :(
Title: Re: Tracking User Activity
Post by: damacguy on January 07, 2006, 08:14:03 PM
I just can't get a break.  :P

Still getting the following error...
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /Library/WebServer/Documents/smf/tracker.php on line 107
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 07, 2006, 08:35:32 PM
Yeah, you don't seem to be having much luck at all... I did test the script on a couple of servers and it works OK so I'm not sure why it's giving you grief... :(
Title: Re: Tracking User Activity
Post by: damacguy on January 07, 2006, 08:45:32 PM
Well, I'm running RC2, php 4.3.11, and the following mods...

Could any of that have an affect? I could uninstall them, but some are 'tweaked'.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 07, 2006, 09:00:36 PM
Hard to say which if any of those mods may be interacting.... the error indicates a problem with the script itself, but I can't seem to reproduce it. I hate to tell you to remove your mods since that's a lot of work... would it be easier to install a qiuck "test" SMF to see if the script runs for a clean install?
Title: Re: Tracking User Activity
Post by: Han on January 07, 2006, 10:25:22 PM
Quote from: Mike Bobbitt on January 07, 2006, 07:56:03 PM
If you re-download the tracker.php script it should work with RC2 but unfortunately no time/date stamps. :(
Thanks i did that. Better some tracks than none  ;)
...but I stil hope you will soon be able to fix the time/date stamps of this tracker.
Title: Re: Tracking User Activity
Post by: dustrho on January 09, 2006, 05:27:53 PM
I'm getting all sorts of error with this now.  I re-downloaded the tracker.php file, moved it to my SMF directory (running 1.1 RC2), and even though it works I'm getting tons of hacking errors at the bottom of the report.  Funny thing is that these error messages are timestamped, where nothing else is.  I sure hope this tool can be functional again, as I used it on a regular basis.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 09, 2006, 08:22:45 PM
Are the errors listed under the "errors" section by chance? :D
Title: Re: Tracking User Activity
Post by: dustrho on January 09, 2006, 08:26:17 PM
Quote from: Mike Bobbitt on January 09, 2006, 08:22:45 PM
Are the errors listed under the "errors" section by chance? :D

Yes.  Here's an example...

QuoteApply Filter: Only show the errors with the same message
Hacking attempt...
SELECT `sandtroopers_com_-_sandtroopers`.yabbse_members.`realName` FROM `sandtroopers_com_-_sandtroopers`.yabbse_members WHERE `sandtroopers_com_-_sandtroopers`.yabbse_members.`ID_MEMBER` = "529";
File: /DIRECTORY/smf/tracker.php

Pay no attention to the "yabbse" in the database name.  I just haven't changed the name of our database yet.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 09, 2006, 09:59:12 PM
If the script is showing the user info and showing errors under the errors section, there's a good chance that's normal. I.E. Maybe these are actual errors the user you're tracking generated.
Title: Re: Tracking User Activity
Post by: LostProphecy on January 15, 2006, 09:54:59 PM
i'd love to try this when it comes back in action... it sounds great...

does it have a limit as to say how many recent action it shows or how many days is classified as recent??
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 16, 2006, 11:41:26 AM
If it's in the database, it'll show it, so "recent" is everything that's logged.
Title: Re: Tracking User Activity
Post by: damacguy on January 21, 2006, 12:29:45 AM
Well, I finaly got around to installing a copy of SMF to test stuff on (should have done that a while back, but now that my site is live it's practically a requirement).

I've done NOTHING but install SMF, and copied the tracker over.

If I go to http://server.com/tracker.php or http://server.com/tracker.php?function=track;u=[uid] I get the same error regarding line 107.
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /Library/WebServer/Documents/smf_test/tracker.php on line 107

I'm running 1.1RC2 and MySQL 4.0.24 on a Mac OS X 10.3.9 Server.

I tried commenting out the {} section around line 107 (from else { on 106 to } on 112), but no go. If I comment out the whole if section (102-116) I get a similar error, but it references line 108.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 21, 2006, 08:51:45 AM
What version of PHP are you using, maybe it doesn't like a command I've used...
Title: Re: Tracking User Activity
Post by: damacguy on January 21, 2006, 12:00:34 PM
php v4.3.11
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 22, 2006, 06:51:36 PM
I believe that should work... I'm coding against 5.0.4, but I don't believe I've done anything too exclusive... I'm honestly at a loss as to why you're having issues. :(
Title: Re: Tracking User Activity
Post by: Cerberus on February 14, 2006, 07:07:18 AM
1.1 RC2, the script shows boards and topics visited by the users, but not the time of the action itself... what's wrong ???
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 14, 2006, 10:07:15 AM
Timestamps have been removed in RC2:

http://www.simplemachines.org/community/index.php?topic=36793.msg443219#msg443219
Title: Re: Tracking User Activity
Post by: Cerberus on February 14, 2006, 11:34:11 AM
Sorry, Mike, haven't noticed that :(
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 14, 2006, 11:58:26 AM
No worries, the thread has kind of wandered through a few topics...
Title: Re: Tracking User Activity
Post by: Madley on February 16, 2006, 03:53:40 PM
Very useful file! Thanks!!! :)
Title: Re: Tracking User Activity
Post by: ZhongFu on February 17, 2006, 12:41:34 PM
Thanks!
Title: Re: Tracking User Activity
Post by: Han on February 20, 2006, 11:21:56 PM
I saw that the edit-date of the first post in this topic had changed, so I hoped that there was now a "tracker.php" that shows also time and date. The old file did not do that. The new tracker-file shows exactly the same als the old file except the new one gives back two errors in my subs.php. I run a standard "SMF 1.1 RC2" forum. I have not made any changes in my subs.php

Here is the top of the page tracker.php that shows me:

User Tracker
This script tracks the recent actions of all users in The Watch List.

Warning: Missing argument 2 for db_query() in /home/pcnaviga/public_html/forum/Sources/Subs.php on line 237

Warning: Missing argument 3 for db_query() in /home/pcnaviga/public_html/forum/Sources/Subs.php on line 237


Tracking Han...

Jump to: Boards || Topics || Monitored Topics || Admin Actions || Errors


Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 21, 2006, 09:13:28 AM
Sorry, no dates... they're just not in the DB to be had. :(

I believe I've fixed the 2 warnings you were seeing...


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Han on February 21, 2006, 10:15:05 AM
Yep, the warnings are gone now. Tnx !!

Just curious....., what is the difference between the old tracker.php and the new one?
Just a change in code of also a change in functionality?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 21, 2006, 10:34:40 AM
It now shows admin actions for moderators.
Title: Re: Tracking User Activity
Post by: dracomiconia on February 23, 2006, 05:25:14 AM
I have this error in 1.0.6

Fatal error: Call to undefined function: determineactions() in /home/draco/public_html/dracoforo/tracker.php on line 154
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 23, 2006, 08:09:01 AM
Yeah, that bit doesn't seem to work right for 1.0.6, just comment out line 154. You won't get to see the user's current actions, but it should work otherwise.

Actually, you'll probably need to comment out another occurrance of determineactions in the newly added admin section too...
Title: Re: Tracking User Activity
Post by: mforum on March 01, 2006, 05:08:14 AM
I would apreciate it if someone fix this to work on 1.0.6

Thanks
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on March 01, 2006, 07:48:36 AM
Did you try commenting out the 2 lines with calls to determineactions() in them? That should do it...
Title: Re: Tracking User Activity
Post by: mforum on March 02, 2006, 03:29:46 AM
Quote from: Mike Bobbitt on March 01, 2006, 07:48:36 AM
Did you try commenting out the 2 lines with calls to determineactions() in them? That should do it...

comment out?  calls?    ohhh i`m too dumie to understand that  ::)
Title: Re: Tracking User Activity
Post by: HoTmetal on March 02, 2006, 09:52:47 PM
Quote from: mforum on March 02, 2006, 03:29:46 AM
Quote from: Mike Bobbitt on March 01, 2006, 07:48:36 AM
Did you try commenting out the 2 lines with calls to determineactions() in them? That should do it...

comment out?  calls?    ohhh i`m too dumie to understand that  ::)


To comment out code, means to tell the PHP parser to ignore it... this can be done by putting two slashes in front of the line like this...

Quote
<?php
// this line is commented out because of the two "//" at the beginning of it.......
print "this line is live code ";
// this line is not......
?>




Title: Re: Tracking User Activity
Post by: mforum on March 03, 2006, 09:07:17 AM
ok, i understand, did it and have no errors  :)
is there a way to change char encoding of page to my lanquage? (ISO-8859-7), i am doing that manualy

Thanks a lot .. !!!
Title: Re: Tracking User Activity
Post by: ディン1031 on March 07, 2006, 06:43:42 AM
Nice Work

I've overwork a little bit the Tracker.php :X

Know it's 1.0.x Compatible ;), and it load some design so it automaticly select your chosen charset...

(Attached to this post the alternativ File :X).

Bye
DIN1031
Title: Re: Tracking User Activity
Post by: mforum on March 07, 2006, 10:34:31 AM
WoW !!!! that rocks !!!!
tested localy on my test forum 1.0.5 and worked fine.
tested on my forum 1.0.6 worked allright exept of this error

Warning: Missing argument 2 for db_query() in /home/*******/public_html/forum/Sources/Subs.php on line 216

line 216 must be
// Do a query.  Takes care of errors too.
function db_query($db_string, $file, $line)
{
global $db_cache, $db_count, $db_connection, $modSettings;


have no idea what it means...

Thanks a lot din1031  :)
Title: Re: Tracking User Activity
Post by: ディン1031 on March 09, 2006, 02:25:00 AM
Look like a Query without __FILE__ and __LINE__

This error should be also in the normal file because i don't alter the other code :)

Serach for:

$result = db_query($query);


Replace with :)

$result = db_query($query, __FILE__, __LINE__);


Bye
DIN1031
Title: Re: Tracking User Activity
Post by: mforum on March 09, 2006, 12:12:10 PM
I did that,,, no errors now !!!!!!
Thanks  :)
Title: Re: Tracking User Activity
Post by: dustrho on March 23, 2006, 01:46:39 PM
I downloaded the updated version of this script, and I think for the most part it's working pretty well.  However, under the Recent Changes section I'm getting these three errors on a repetitive basis...

Quote8: Undefined index: uot_users_online_today_title
File: /home/virtual/site1/fst/var/www/html/smf/Themes/default/BoardIndex.template.php (eval?)
Line: 406   2006/03/23 12:32:58
8: Undefined index: uot_users_online_today_title
File: /home/virtual/site1/fst/var/www/html/smf/Themes/default/BoardIndex.template.php (eval?)
Line: 409   2006/03/23 12:32:58
8: Undefined index: uot_users_online_today
File: /home/virtual/site1/fst/var/www/html/smf/Themes/default/BoardIndex.template.php (eval?)
Line: 416

Any ideas as to what this might mean?  Is this script working for me?  I placed the tracker.php file under SMF and the SSI.php file is in the same location, so it should be working okay.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on March 23, 2006, 02:18:32 PM
My BoardIndex.template.php doesn't have any references to uot_users_online_today_title, is it possible this comes from an installed mod?
Title: Re: Tracking User Activity
Post by: deadpoeticstar on March 23, 2006, 02:29:53 PM
can you clarify for me how i need to set this up? cause ive tried several times and i dont think its working like ive seen in you screen shots
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on March 23, 2006, 02:41:10 PM
The screenshots are a bit old... the new (1.1) SMF doesn't include timestamps in the database unfortunately. :(
Title: Re: Tracking User Activity
Post by: ディン1031 on March 24, 2006, 03:05:10 AM
This error comes from the online users today mod :x i think -> uot_users_online_today txt variable is missing.

To Load this i think you must add someting :)
Change this code 

if(function_exists('loadTemplate') && $load_template) {
loadTemplate('index');
template_init();
template_main_above();
}


to


if(function_exists('loadTemplate') && $load_template) {
loadTemplate('index');
loadLanguage('Who');
loadLanguage('Modifications'); //If you need more Language Files to Load than copy the line and insert the name of the file.
template_init();
template_main_above();
}


I hope it work ;).

Bye
DIN1031
Title: Re: Tracking User Activity
Post by: dustrho on March 24, 2006, 10:02:05 AM
What file does that need to be edited in?  I check a few different files and didn't find that at all.
Title: Re: Tracking User Activity
Post by: ディン1031 on March 24, 2006, 12:58:44 PM
Quote from: dustrho on March 24, 2006, 10:02:05 AM
What file does that need to be edited in?  I check a few different files and didn't find that at all.
In the Tracker.php from me ;).

Bye
DIN1031
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on March 24, 2006, 01:09:54 PM
For the record, din1031 is talking about his modified Tracker.php (http://www.simplemachines.org/community/index.php?topic=36793.msg505284#msg505284)... you won't find those lines in the base model. :)
Title: Re: Tracking User Activity
Post by: dustrho on March 24, 2006, 02:18:55 PM
I made the suggested changes in the modified tracker.php file, and I'm still getting all those error messages at the bottom of the page.  I do like how you incorporated this into the forum itself, instead of being on a plain jane white page.  Nicely done!
Title: Re: Tracking User Activity
Post by: xtremecruiser on September 06, 2006, 12:26:47 PM
Somehow adding back the timestamps would be so nice with this tool ;D

Related topic

http://www.simplemachines.org/community/index.php?topic=63763.html

Quote from: Mike Bobbitt on January 04, 2006, 11:57:36 AM
I noticed that myself recently... I've asked about it here (http://www.simplemachines.org/community/index.php?topic=63763.msg440686#msg440686) but no reply yet.

I've updated the script to work with RC2, but unfortunately that means no date/time indicators, which makes it pretty much useless. :( If that info is stored somewhere, I can add it back in.


Cheers
Mike

Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 07, 2006, 11:47:15 AM
Yeah, the timestamps are still missing in RC3, I was hoping they'd be back. :(
Title: Re: Tracking User Activity
Post by: xtremecruiser on September 07, 2006, 12:04:31 PM
Quote from: Mike Bobbitt on September 07, 2006, 11:47:15 AM
Yeah, the timestamps are still missing in RC3, I was hoping they'd be back. :(
Me too, good to see your still around Mike !
Maybe they will add them in the final version  ;D :-X
Title: Re: Tracking User Activity
Post by: juli on October 04, 2006, 10:36:41 PM
Quote from: Han on February 20, 2006, 11:21:56 PM

User Tracker
This script tracks the recent actions of all users in The Watch List.

I'm brand new to SMF and in the process of converting a board. I've got a problem person and this mod is going to be extremely helpful to me! But I'm wondering...what is "The Watch List?"
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on October 05, 2006, 07:38:39 AM
The Watch List is optional, but can be a group you put users in and they will automatically appear on the picklist on the main screen.
Title: Re: Tracking User Activity
Post by: juli on October 05, 2006, 01:28:04 PM
So it's a group I make up myself, then?

Just wanted to make sure I hadn't missed something. This is going to be a helpful script. I tested it out, had a couple of errors, but those were cleared up by some code posted earlier and it rocks!

I have a problem idiot who hasn't given up in five+ years and continually finds ways to get in with fake names. (free trial ISPs, friends' computers, internet cafes, etc....the guy is really obsessed). A watch list will be perfect because if there's somebody I think is suspicious, I can put them in the watch list. This fool is nothing if predictable. He's easy to spot once he gets going.

Thanks so much for the script! Now if someone would do a miserable user/Coventry script so I can keep sending him to hell...
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on October 05, 2006, 04:40:24 PM
Yep, just create the group and identify the group ID# in the script.

If you've got a repeat user, you may also find this script (http://www.simplemachines.org/community/index.php?topic=33992.0) useful. I can also provide some additional info if you're interested in the Watch List concept, just PM me.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: juli on October 05, 2006, 05:25:10 PM
Oh my, that looks positively delightful! Perhaps you share my experience with bad boys?  ;D

Thanks for your help!

Juli
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on October 06, 2006, 03:07:04 PM
Quote from: juli on October 05, 2006, 05:25:10 PM
Oh my, that looks positively delightful! Perhaps you share my experience with bad boys?  ;D

Er... I'll take that from a technical angle, and say yes. :)
Title: Re: Tracking User Activity
Post by: edi67 on January 27, 2007, 06:07:16 PM
sorry but how i can permit to another usergroup to use this tracker?

help me please
Title: Re: Tracking User Activity
Post by: Smurfbutcher Bob on January 27, 2007, 10:47:40 PM
I just grabbed this script tonight, so I'm not too familiar with it.  It appears that the "watchlist" is based on a specific group ID.  Personally, I'm too nosey for something like that - I want all groups.

So, I just made a change to not use the "watchlist" anymore. Instead, I can pick whatever groups I like.



At the bottom of his script, you'll find a snippet that looks like (or, should look like)

// Get list of users in The Watch List
if ($armyca) {
$result = db_query("SELECT * FROM $db_member_table WHERE ...

echo "Select the user you want to track:<br /><br />\\n";

while ($res = mysql_fetch_array($result)) {

(SNIPPED)

include "$include_dir/footer.php";
}



Note that I omitted some stuff from the middle, to keep this post short.

Remove that chunk of code, and replace it with


$db_group_table = "membergroups";
$db_group_table = "$db_prefix$db_group_table";
if (isset($_REQUEST["gid"]))
$gid = $_REQUEST["gid"];

// Who's on

// Get the user's current action
$result = db_query("SELECT $db_member_table.realName, $db_member_table.ID_MEMBER FROM $db_log_online_table, $db_member_table WHERE $db_log_online_table.ID_MEMBER = $db_member_table.ID_MEMBER ORDER BY $db_log_online_table.`logTime` DESC", __FILE__, __LINE__);

echo "<br /><br /><a href=\\"tracker.php\\">Currently online:</a><br /><br />\\n";
while ($res = mysql_fetch_array($result))
echo "<a href=\\"$scripturl?action=profile;u=$res[ID_MEMBER]\\">Profile</a> or <a href=\\"?function=track;u=$res[ID_MEMBER]\\">Track</a>: $res[realName]<br />\\n";

mysql_free_result($result);


if (isset($gid))
{
// Get list of users in The Watch List
$result = db_query("SELECT * FROM $db_member_table WHERE $db_member_table.ID_Group = $gid or $db_member_table.`additionalGroups` LIKE \\"%$gid%\\"", __FILE__, __LINE__);

echo "<br /><br />Select the user you want to track:<br /><br />\\n";
while ($res = mysql_fetch_array($result))
echo "<a href=\\"$scripturl?action=profile;u=$res[ID_MEMBER]\\">Profile</a> or <a href=\\"?function=track;gid=$gid;u=$res[ID_MEMBER]\\">Track</a>: $res[realName]<br />\\n";

mysql_free_result($result);
echo "<br /><br /><a href=\\"tracker.php\\">Groups...</a>\\n";
}
else
{
// Get list of Groups
$result = db_query("SELECT * FROM $db_group_table", __FILE__, __LINE__);

echo "<br /><br />Select the group you want to view:<br /><br />\\n";
echo "<a href=\\"?gid=0\\">Default Group</a><br />\\n";
while ($res = mysql_fetch_array($result))
echo "<a href=\\"?gid=$res[ID_GROUP]\\">$res[groupName]</a><br />\\n";

mysql_free_result($result);
}



The above will always show, and allow you to pick from "Who's online".
Additionally, it will allow you to view a group.
Once you pick a group, it'll show the users in that group.
You can then pick them, or return to choose another group, or a specific user, etc.

This is a great little script... but without those timestamps he was talking about, it is somewhat expensive to run.
Title: Re: Tracking User Activity
Post by: ディン1031 on January 28, 2007, 06:44:15 AM
Quote from: edi67 on January 27, 2007, 06:07:16 PM
sorry but how i can permit to another usergroup to use this tracker?

help me please
Hmmm which tracker file did you use? ;)

Bye
DIN1031
Title: Re: Tracking User Activity
Post by: edi67 on January 28, 2007, 06:59:35 AM
Quote from: din1031 on January 28, 2007, 06:44:15 AM
Quote from: edi67 on January 27, 2007, 06:07:16 PM
sorry but how i can permit to another usergroup to use this tracker?

help me please
Hmmm which tracker file did you use? ;)

Bye
DIN1031
indifferent

i have all 2 both and your :)
Title: Re: Tracking User Activity
Post by: ディン1031 on January 28, 2007, 08:13:48 AM
Serach for

// Set this to restrict access. Currently only admins are allowed.
$isstaff = $user_info['is_admin'];


and replace it with:

// Set this to restrict access. Currently only admins are allowed.
$isstaff = $user_info['is_admin'] || in_array(2, $user_info['groups']);


This code || in_array(2, $user_info['groups']) is for global mods to be allowed to see this. To add more use this phrase and change the 2 to the id of the group who is allowed to use this and add it after the current phrase ;) For each allowed group you need to add this phrase.

Bye
DIN1031
Title: Re: Tracking User Activity
Post by: edi67 on January 28, 2007, 09:46:25 AM
excellent and perfect thx din  ;)
Title: Re: Tracking User Activity
Post by: 1948Pal on February 06, 2007, 08:56:42 PM
Does anyone know if this scripts runs under smf 1.1.1? Cause I get this error when I try to run it:
"You are not Army.ca Staff".
I remember it working before with older SMFs, but now I'm not sure.
[edit]
Nevermind, I wasn't logged in to the forum.
[/edit]
Title: Re: Tracking User Activity
Post by: babjusi on February 06, 2007, 09:48:31 PM
Where can I download this mod please?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 08, 2007, 07:31:29 PM
Hi babjusi,

The files are attached to the first post: http://www.simplemachines.org/community/index.php?topic=36793.msg269811#msg269811


Cheers
Mike
Title: Re: Tracking User Activity
Post by: babjusi on February 08, 2007, 10:02:44 PM
Quote from: Mike Bobbitt on February 08, 2007, 07:31:29 PM
Hi babjusi,

The files are attached to the first post: http://www.simplemachines.org/community/index.php?topic=36793.msg269811#msg269811


Cheers
Mike

Thanks for your answer, will this be coming as a mod? I mean zipped in a package that could be installed via the Package Manager? Thank u
Title: Re: Tracking User Activity
Post by: veldfire on February 12, 2007, 04:35:43 PM
Quote from: Mike Bobbitt on October 05, 2006, 04:40:24 PM
Yep, just create the group and identify the group ID# in the script.

Cheers
Mike
Does the group name "The Watch List" need to be just that or anything we create ?

I've changed the following bit to match "The Watch List" group yet nobody
shows and I have someone in there although they are banned ?

// Warning group IDs (primary)
$watchlist = "10";
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 13, 2007, 05:07:02 PM
babjusi: I'm not very good at packages, so I think for now I'd better not. It's completely standalone anyway, so no SMF files need to be modified. Just drop it in place and browse to it.

veldfire: The group name can be anything, so long as the group ID # is correct. I should have also mentioned... users need to have the specified group as an additional group, not a primary one. The idea is to "tag" a user in a way that is not visible.

You could change:

$result = db_query("SELECT * FROM $db_member_table WHERE $db_member_table.`additionalGroups` LIKE \"%$watchlist%\"", __FILE__, __LINE__);


to:

$result = db_query("SELECT * FROM $db_member_table WHERE $db_member_table.`ID_GROUP` LIKE \"%$watchlist%\"", __FILE__, __LINE__);

in order to use the primary group ID.
Title: Re: Tracking User Activity
Post by: veldfire on February 13, 2007, 07:10:26 PM
Thanks...Will give it a try.
Title: Re: Tracking User Activity
Post by: drzen on February 22, 2007, 08:29:15 AM
Wha's about tracking pm activies? (e.g. number of pm send)

Any idea?

dr
Title: Re: Tracking User Activity
Post by: ディン1031 on February 22, 2007, 12:56:59 PM
That's something what is agains the smf condition. A PM is something privat and should be privat.

Bye
DIN1031
Title: Re: Tracking User Activity
Post by: babjusi on February 23, 2007, 07:23:15 AM
Quote from: DIN1031 on February 22, 2007, 12:56:59 PM
That's something what is agains the smf condition. A PM is something privat and should be privat.

Bye
DIN1031

I agree as well with DIN1031 about the privacy of the private messages
Title: Re: Tracking User Activity
Post by: rbdesign on March 20, 2007, 05:39:09 AM
I'm using this, but for some users, I can't see the last topics accessed. I just have some info, not all info. I tried this with my account just to see and I see parts of the tracking information.
Title: Re: Tracking User Activity
Post by: ladynada on April 01, 2007, 12:48:19 AM
hi Smurfbutcher Bob,

I get errors on your echo lines of code, expecting a , or a ;

this line

echo "<br /><br /><a href=\\"tracker.php\\">Currently online:</a><br /><br />\\n";


for example,
anyoneknow why?
thanks,
nada
Title: Re: Tracking User Activity
Post by: Smurfbutcher Bob on April 01, 2007, 02:25:57 PM
You need to remove those double-backslashes, Ladynada - they should be single. It's probably an effect of making the code into a forum post  ::)

echo "<br /><br /><a href=\"tracker.php\">Currently online:</a><br /><br />\n";

You'll probably discover that the same thing has happened to a few other lines, as well - do a Find for \\ (double backslash) and make them all \ (single).
Title: Re: Tracking User Activity
Post by: ladynada on April 02, 2007, 07:06:03 AM
Quote from: Smurfbutcher Bob on April 01, 2007, 02:25:57 PM
You need to remove those double-backslashes, Ladynada - they should be single. It's probably an effect of making the code into a forum post  ::)

echo "<br /><br /><a href=\"tracker.php\">Currently online:</a><br /><br />\n";

You'll probably discover that the same thing has happened to a few other lines, as well - do a Find for \\ (double backslash) and make them all \ (single).


thank you.

nada
Title: Re: Tracking User Activity
Post by: talkbristol on May 09, 2007, 01:22:49 PM
Owners/moderators need to post something interesting every few days to keep a new forum 'ticking over'.

It would be great if something like this mod could send out an email when nothing has happened on a forum for eg 3 days.
Title: Re: Tracking User Activity
Post by: BYUFanatic on May 26, 2007, 01:07:34 AM
Any word on the date/time stamp issue? I'd love to have that as part of the Tracker.

Rob
Title: Re: Tracking User Activity
Post by: BYUFanatic on May 26, 2007, 01:12:19 AM
Is it also possible to modify Tracker to have it track user activity for a particular post?

Basically I'd like to see a list of who has read a specific post.

Rob
Title: Re: Tracking User Activity
Post by: scalawaggirl on June 11, 2007, 09:30:26 AM
Is this still available?  I'm on 1.1.2 and am looking for the ability to track user activity.  I did not see any files attached to the original message, however.
Title: Re: Tracking User Activity
Post by: th-hits on June 21, 2007, 01:38:49 PM
This script tracks the recent actions of all users in The Watch List.


Could someone tell me what is causing these warnings?


Warning: Missing argument 2 for db_query() in /home/kelleyad/public_html/forums/Sources/Subs.php on line 238

Warning: Missing argument 3 for db_query() in /home/kelleyad/public_html/forums/Sources/Subs.php on line 238
Tracking mike...
Title: Re: Tracking User Activity
Post by: KERA on June 28, 2007, 01:10:46 AM


Ι use SMF 1.1.3 ans the track user isnt working!

any ideas?
Title: Re: Tracking User Activity
Post by: babjusi on June 28, 2007, 03:35:51 AM
Quote from: KERA on June 28, 2007, 01:10:46 AM


Ι use SMF 1.1.3 ans the track user isnt working!

any ideas?

Same thing here. I keep getting some error message.
Title: Re: Tracking User Activity
Post by: KERA on June 28, 2007, 12:24:20 PM


so still the same problem!

not working! ::) ::) ::) ::)
Title: Re: Tracking User Activity
Post by: babjusi on June 28, 2007, 12:26:29 PM
What error message you get KERA?
Title: Re: Tracking User Activity
Post by: mylesmadness on June 28, 2007, 01:41:06 PM
This is SUPER cool
Title: Re: Tracking User Activity
Post by: KERA on June 29, 2007, 01:50:41 AM
Quote from: babjusi on June 28, 2007, 12:26:29 PM
What error message you get KERA?

I dont get any error but when I try to search an ip i dont get anything.

I dont know what I should do.
Title: Re: Tracking User Activity
Post by: edi67 on July 03, 2007, 04:46:16 PM
very strange some months ago worked perfectly now not more i have a lot of these errors trying to use it:

Errore del Database : No database selected
File: /home2/crazyzonews/www/Sources/Subs.php
Linea: 3362


Line 3362:
         WHERE fc.userid IS NOT NULL
            AND mem.ID_MEMBER != 0
         ORDER BY mem.realName ASC", __FILE__, __LINE__);

some solution for fix it??
Title: Re: Tracking User Activity
Post by: KERA on July 07, 2007, 02:58:12 PM


any ideas??????
Title: Re: Tracking User Activity
Post by: Kip on July 18, 2007, 08:19:41 PM
I'm under the impression that this won't work with the new SMF 1.1 because the table smf_log_topics doesn't record the exact time someone last looked at the topic, only what the highest id_msg was at the time.
Title: Re: Tracking User Activity
Post by: metallica48423 on August 17, 2007, 12:35:17 AM
I believe kip is correct. 

Have any of you considered PM'in Mike Bobbit and asking him if he can update the script?  He has been active fairly recently.
Title: Re: Tracking User Activity
Post by: John S on August 27, 2007, 02:39:44 AM
it doesnt display the time and date for me
Title: Re: Tracking User Activity
Post by: exxocet on October 11, 2007, 12:50:52 PM
Yes, good script, but without date & time is completely useless... :(
Title: Re: Tracking User Activity
Post by: exxocet on October 12, 2007, 10:05:53 AM
Come on, I'm sure is not so hard to do this Time feature for an experienced php men.
Title: Re: Tracking User Activity
Post by: metallica48423 on November 14, 2007, 02:52:47 AM
like i said, has no-one tried PM'ing him to see if he can update it?  IIRC this was written for 1.0... so naturally it probably wont work for 1.1...

Title: Re: Tracking User Activity
Post by: author on November 19, 2007, 11:23:03 AM
Very nice!!!! Works perfectly and fulfills a need. Thanks!

--Ralph
http://urtvforums.org
Title: Re: Tracking User Activity
Post by: fireandsalt on December 27, 2007, 04:27:52 PM
Sweet... thanks for the tracker.
Title: Re: Tracking User Activity
Post by: Jalkson on January 06, 2008, 11:03:03 AM
Very nice mod, and it appears to be working for me just fine.

SMF 1.1.4.


Title: Re: Tracking User Activity
Post by: TheWrath! on January 06, 2008, 11:20:06 AM
works great. even on 1.1.4
Title: Re: Tracking User Activity
Post by: Jalkson on January 10, 2008, 05:44:04 PM
I wanted to say thanks to ButcherBob as well, his little snippet works perfectly. :]
Title: Re: Tracking User Activity
Post by: cesarauz on January 11, 2008, 08:10:56 AM
Hello all!

I have the same error of Han...   

Quote from: Han on February 20, 2006, 11:21:56 PM
User Tracker
This script tracks the recent actions of all users in The Watch List.

Warning: Missing argument 2 for db_query() in /home/pcnaviga/public_html/forum/Sources/Subs.php on line 237

Warning: Missing argument 3 for db_query() in /home/pcnaviga/public_html/forum/Sources/Subs.php on line 237


Tracking Han...

Jump to: Boards || Topics || Monitored Topics || Admin Actions || Errors

and I didn't understand how to solve.  :(

Another question... How can I create a Watch List?

I need to track the actions done by an user... this user surf in the forum but never post (it isn't a bot, his IP address is from a big italian ISP and sometimes is logged on and sometimes surf as Visitor.
Isn't it possible to track the actions from an IP address in way to track also the actions when he isn't logged on?

Sorry for the confused questions, but by acknowledge in SMF are really at newbie level...
Title: Re: Tracking User Activity
Post by: Jalkson on January 11, 2008, 02:24:21 PM
For your first issue, try this solution.

http://www.simplemachines.org/community/index.php?topic=36793.msg506933#msg506933
Title: Re: Tracking User Activity
Post by: rosey on January 23, 2008, 07:10:42 PM
Quote from: rbdesign on March 20, 2007, 05:39:09 AM
I'm using this, but for some users, I can't see the last topics accessed. I just have some info, not all info. I tried this with my account just to see and I see parts of the tracking information.

this is happening to me too...
Title: Re: Tracking User Activity
Post by: metallica48423 on February 03, 2008, 07:02:24 PM
is there any pattern in the members it doesn't work for?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on February 09, 2008, 04:49:55 PM
As I recall, argument 2 and 3 to db_query() are __FILE__ and __LINE__ respectively. I verified that every call has these 2 arguments, so it would seem that for some (inexplicably) they are not defined. I didn't think PHP could hide those, but maybe it's a global setting or something?
Title: Re: Tracking User Activity
Post by: raferb on March 04, 2008, 07:11:37 PM
Is the 'no date/timstamp' issue just a fact of life for 1.1.4?

Thanks for the very cool mod.  Not having it as an official downloadable package made it difficult to find though.  I'm sure more would use it if it was 'main streamed' somehow, even though it doesn't need to be made into a package due to it's standalone nature. I had to search for 30 min before I finally hit upon the right words to dig up this thread.  Anyway, how about those dates?
Title: Re: Tracking User Activity
Post by: dsanchez on March 28, 2008, 01:51:42 PM
Using SMF 1.1.4, it shows me a blank page everytime I try to track an user :(
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on March 29, 2008, 12:35:57 PM
Do you see any errors in the error log for SMF or your web server/PHP?
Title: Re: Tracking User Activity
Post by: dsanchez on April 07, 2008, 04:30:44 PM
Quote from: Mike Bobbitt on March 29, 2008, 12:35:57 PM
Do you see any errors in the error log for SMF or your web server/PHP?

Now is working fine!..strange.

Thanks!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on April 07, 2008, 07:16:53 PM
Heh... glad to help! ;)
Title: Re: Tracking User Activity
Post by: dsanchez on April 08, 2008, 11:33:38 AM
Love the tracker, tell me, its possible to track if someone viewed some profile? or if attempted to see it? thanks!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on April 08, 2008, 08:49:58 PM
Unfortunately there is nothing logged in SMF when that happens. You could probably pick that info out of your web server logs though...
Title: Re: Tracking User Activity
Post by: Jed C on April 12, 2008, 04:53:44 AM
just installed this and it seems to be what i want ;)
but like cesarauz i am new to all this and also would
like to know how to create watch list
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on April 12, 2008, 10:00:36 AM
It's pretty easy actually... just create a new group, add it to the members you need to monitor (as a secondary group or else they'll see it!)

In tracker.php change this:

// Warning group IDs (primary)
$watchlist = "23";


to use the actual group ID# for the new group and you're all set!

Cheers
Mike
Title: Re: Tracking User Activity
Post by: Jed C on April 12, 2008, 10:23:24 AM
Quote(as a secondary group or else they'll see it!)
how do you add them as secondary group ?
sorry for being dumb
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on April 12, 2008, 11:06:09 AM
Sorry, the SMF term is actually Additional Group not secondary group. When you're editing a profile just click on "[ show additional groups ]" to show the full list.
Title: Re: Tracking User Activity
Post by: Jed C on April 12, 2008, 11:13:02 AM
right think i am with you now  ;)
i will give it a go
Title: Re: Tracking User Activity
Post by: Jed C on April 12, 2008, 11:18:08 AM
yep got that  ;D
will edit php now  :o
Title: Re: Tracking User Activity
Post by: Jed C on April 12, 2008, 11:40:25 AM
cheers mike
that seems to have gone ok
just need to figure how what to do with it now  ::)
Title: Re: Tracking User Activity
Post by: samvirtual on April 24, 2008, 06:14:20 PM
awesome!
Title: Re: Tracking User Activity
Post by: qtwre on April 28, 2008, 10:37:54 AM
can this be done to track guest too?  or ip?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on April 28, 2008, 01:18:53 PM
Guests don't leave the same sort of trail in the SMF logs, so unfortunately not...
Title: Re: Tracking User Activity
Post by: qtwre on April 28, 2008, 01:26:56 PM
Guest do have activities isn't it?  You confused me.
Title: Re: Tracking User Activity
Post by: Aleksi "Lex" Kilpinen on April 28, 2008, 05:34:32 PM
Nice tool! :) Thanks!
Title: Re: Tracking User Activity
Post by: edi67 on May 09, 2008, 06:42:03 AM
Is possible have this for SMF 2.0 ?
Title: Re: Tracking User Activity
Post by: Powerbob on June 13, 2008, 02:35:40 AM
Yes that would be awesome to have it in 2.0
I have had it working on my boards since this tip was first posted.

Thanks
Bob
Title: Re: Tracking User Activity
Post by: bros on July 11, 2008, 12:02:10 AM
I also wonder if this is possible in SMF 2.
Title: Re: Tracking User Activity
Post by: madman71 on July 26, 2008, 04:21:55 AM
mike,

I want to allow my global mods to use this tool.  Do you have any code snippet that i can add to your php so they can use it?
Title: Re: Tracking User Activity
Post by: curlydog on July 27, 2008, 07:45:04 PM
Never mind got it work.....thanks Mike

Quote from: Mike Bobbitt on May 24, 2005, 12:47:14 PM
I've created a simple script to track recent user activity on SMF. It's nothing fancy, but if you want to find out what people have been up to (useful for keeping tabs on potential trouble) you may find this handy.

Installation is simple, just drop it in to your SMF directory (same one that contains SSI.php), then browse to tracker.php.

You can enter the username, display name or user ID# for a user to track. Due to the nature of the info provided, currently only forum admins are allowed to run the script.

I've included a couple screen shots to show the general functionality.


Cheers
Mike

Update: Now shows moderator actions as well.
Title: Re: Tracking User Activity
Post by: madman71 on July 27, 2008, 07:50:45 PM
Did you put the tracker.php file in your forum directory?

if you did then in your browser type:


http://www.yourwebsiteaddress.com/forum/tracker.php

and that should do it :)
Title: Re: Tracking User Activity
Post by: bros on July 30, 2008, 03:01:20 PM
I hope this will be made to work with SMF 2.0
Title: Re: Tracking User Activity
Post by: Deprecated on July 31, 2008, 12:54:49 PM
Yeah, really! And I just *LOVE* the installation: drag 'n drop! ;)

No worry that this will be the one that implodes your carefully set up forum. :)
Title: Re: Tracking User Activity
Post by: Jessikard on August 19, 2008, 01:27:28 PM
may anybody post the complete installation working with 1.1.5 please ?
Title: Re: Tracking User Activity
Post by: madman71 on August 19, 2008, 01:30:27 PM
Jess,

I have my running on 1.1.5 and there were no probs making this work.

just follow these instructions and that's it.



   

Installation is simple, just drop it in to your SMF directory (same one that contains SSI.php), then browse to tracker.php.

You can enter the username, display name or user ID# for a user to track. Due to the nature of the info provided, currently only forum admins are allowed to run the script.


It cant be any easier  :D
Title: Re: Tracking User Activity
Post by: Jessikard on August 19, 2008, 01:34:49 PM
is it the same tracker.php like that at the first post in attachment ?

edit: okay, it works - but teh script shows all the boards in our Forum  :( without timestamp
Title: Re: Tracking User Activity
Post by: madman71 on August 19, 2008, 01:40:30 PM
That's the one that i used.  Just DL it and drop it in :)
Title: Re: Tracking User Activity
Post by: Jessikard on August 19, 2008, 02:15:55 PM
Quote from: madman71 on August 19, 2008, 01:40:30 PM
That's the one that i used.  Just DL it and drop it in :)
do you have timestamps in this script ?
Title: Re: Tracking User Activity
Post by: madman71 on August 19, 2008, 02:21:33 PM
If i recall correctly, no, i dont.  I think SMF updated something that disabled this part of the mod.  The reason is somewhere in this thread.

you might be interested in this mod http://custom.simplemachines.org/mods/index.php?mod=1300

It's a integrated into SMF unlike this one.
Title: Re: Tracking User Activity
Post by: Jessikard on August 19, 2008, 02:35:28 PM
 :o oh, i try to install this mod - thx  ;)
Title: Re: Tracking User Activity
Post by: bros on September 30, 2008, 11:25:15 PM
CAn someone make this work on SMF 2.0?
Title: Re: Tracking User Activity
Post by: Haffina on October 05, 2008, 01:01:04 AM
Quote from: bros on September 30, 2008, 11:25:15 PM
CAn someone make this work on SMF 2.0?
Yeah..we'd like that too :)
Title: Re: Tracking User Activity
Post by: Kreator on October 14, 2008, 05:24:27 PM
Hah I tried this today... dropped it in my forum and when I browsed to it got the
following :


ERROR: You are not Army.ca Staff.

whatever that is!
Title: Re: Tracking User Activity
Post by: HR on January 31, 2009, 10:34:58 AM
Now.. if we could skin this and work it in then Id be in pure bliss
Title: Re: Tracking User Activity
Post by: rootkid on March 27, 2009, 09:12:38 AM
Great mod, thanks!

I changed it a bit to show my registered users what the admin user is doing.
I tried to upload my version and a patch file but was either too stupid to find a file upload button or simply don't have the rights to do it.

Nevertheless, if someone's interested, contact me and i'll mail you the files.

best regards,
Heiner

Title: Re: Tracking User Activity
Post by: ellion on April 27, 2009, 11:37:43 AM
thank you so much this is a brilliant idea.

i recenlty had one user that registered three acounts and was setting up one particular thread for spamming links to his viagra site. using this i might have sussed him out earlier.

thanks again
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on July 10, 2009, 05:11:10 PM
All,

Sorry for the delay, I've finally built a version for SMF 2. It looks like attach permissions have been removed from this board, but I've put the new script up here for now:

http://army.ca/deleteme/tracker.zip

If this link stops working, contact me. :)


Thanks for your patience!
Mike
Title: Re: Tracking User Activity
Post by: JeremyB. on July 10, 2009, 08:58:44 PM
This is pretty cool thanks.

-JB
Title: Re: Tracking User Activity
Post by: Powerbob on September 11, 2009, 12:59:57 AM
Thanks Mike 8)

Bob
Title: Re: Tracking User Activity
Post by: Tones on September 12, 2009, 12:02:39 PM
I've made some changes to the tracker myself to include a few things i needed for what i'm using it for.  But i'm a tard and didnt save the message i sent to Mike with the changes, so i'm just attaching my file. For smf 1.1.10

Additional code to display the primary groups of those added to the watch list, I've also added time stamps and edit the existing code to work with that, and html to skin it which  will use the images from your forum template.

With this version though note i've limited the number of topics displayed to 50, with large communities we'd just end up with a mile long list but you can change this. And i'll include a small change you can make to the profile.php page to link the tracker through the track user link there.

Run these queries in phpmyadmin to add the logtime fields to the database tables we call the info from. Change the database prefix if yours differs.

ALTER TABLE `smf_log_boards` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE `smf_log_topics` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;



open the tracker.php file

On line 8 find

if (preg_match("/yoursite.com$/i", $_SERVER["HTTP_HOST"])) {

Replace yoursite.com with your domain

For the edit to link the tracker to the users profile

Open Sources/profile.php
find

$context['profile_areas']['info']['areas']['trackUser'] = '<a href="' . $scripturl . '?action=profile;u=' . $memID . ';sa=trackUser">' . $txt['trackUser'] . '</a>';


Replace with

$context['profile_areas']['info']['areas']['trackUser'] = '<a href="./tracker.php?function=track;u=' . $memID . '">' . $txt['trackUser'] . '</a>';


I think i remembered everything.

download link to be updated

(http://i180.photobucket.com/albums/x93/tonesrlc/tracker.jpg)
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 13, 2009, 08:43:43 AM
Fantastic, thanks for the great work Tones!
Title: Re: Tracking User Activity
Post by: Blinker on September 16, 2009, 08:16:31 AM
Tones, when I try and run those queries on my db, I get this error:

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'

I assume I can't use your version of the tracker without being able to alter my db unless I remove all references to the timestamps, correct?

Using 1.1.10 and MySQL Server version: 4.0.27-max-log
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 16, 2009, 10:31:20 AM
Blinker,

You'd have to be able to run the 2 ALTER TABLE commands near the top of Tones' post in order for his code changes to work.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Tones on September 16, 2009, 06:00:18 PM
Run them individually
Title: Re: Tracking User Activity
Post by: mandukar on September 16, 2009, 06:09:01 PM
does this have the ability to see who moved what thread where?
Title: Re: Tracking User Activity
Post by: Tones on September 16, 2009, 06:25:01 PM
Quote from: mandukar on September 16, 2009, 06:09:01 PM
does this have the ability to see who moved what thread where?

It appears to show what topic was moved by who on what i'm using, i didnt change anything drastic of what Mike had already done, so any of the versions on the thread will do. Ensure  log moderation actions is checked under the features and options in the admin panel.
Title: Re: Tracking User Activity
Post by: Blinker on September 17, 2009, 07:12:36 AM
Quote from: Mike Bobbitt on September 16, 2009, 10:31:20 AMYou'd have to be able to run the 2 ALTER TABLE commands near the top of Tones' post in order for his code changes to work.

Yeah I figured that, it changes too much code from yours. I compared them beforehand to see what he changed. I've reverted back to yours until I can get this sorted.

Quote from: Tones on September 16, 2009, 06:00:18 PMRun them individually

I did.

I went into PMA, selected my db, clicked on SQL, pasted the first query only into the box and clicked go. Then I got that error.

Same thing happened with the second one.

Any ideas?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on September 17, 2009, 10:23:00 AM
These commands may work better for you:

ALTER TABLE `smf_log_boards` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE `smf_log_topics` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
Title: Re: Tracking User Activity
Post by: Tones on September 17, 2009, 12:43:51 PM
Thanks Mike, i did send him a message  and noted how to manually add them too. Hopefully it's helped, What i'll do too is edit my post with what you have
Title: Re: Tracking User Activity
Post by: schmooot on September 28, 2009, 06:37:59 PM
Quote from: Tones on September 12, 2009, 12:02:39 PM
I've made some changes to the tracker myself to include a few things i needed for what i'm using it for.  But i'm a tard and didnt save the message i sent to Mike with the changes, so i'm just attaching my file. For smf 1.1.10

Additional code to display the primary groups of those added to the watch list, I've also added time stamps and edit the existing code to work with that, and html to skin it which  will use the images from your forum template.

With this version though note i've limited the number of topics displayed to 50, with large communities we'd just end up with a mile long list but you can change this. And i'll include a small change you can make to the profile.php page to link the tracker through the track user link there.

Run these queries in phpmyadmin to add the logtime fields to the database tables we call the info from. Change the database prefix if yours differs.

ALTER TABLE `smf_log_boards` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE `smf_log_topics` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;



open the tracker.php file

On line 8 find

if (preg_match("/yoursite.com$/i", $_SERVER["HTTP_HOST"])) {

Replace yoursite.com with your domain

For the edit to link the tracker to the users profile

Open Sources/profile.php
find

$context['profile_areas']['info']['areas']['trackUser'] = '<a href="' . $scripturl . '?action=profile;u=' . $memID . ';sa=trackUser">' . $txt['trackUser'] . '</a>';


Replace with

$context['profile_areas']['info']['areas']['trackUser'] = '<a href="./tracker.php?function=track;u=' . $memID . '">' . $txt['trackUser'] . '</a>';


I think i remembered everything.

www.habitat-zaby.com/tracker.zip

(http://i180.photobucket.com/albums/x93/tonesrlc/tracker.jpg)
it appears to work so far.  A couple issues I have though.  Unless I've read it wrong you said you got the timestamps to work?  but they just show zero's for me.

Also  I get the following error when tracking some users

PHP Notice:  Use of undefined constant logTime - assumed 'logTime' in C:\Forum\tracker.php on line 351
PHP Notice:  Use of undefined constant logTime - assumed 'logTime' in C:\Forum\tracker.php on line 351


any ideas on that one?

Oh and it may be anal of me but your first edit in the tracker.php file is actually on line 14 not 8
Title: Re: Tracking User Activity
Post by: Tones on September 29, 2009, 02:16:32 PM
okay the second issue was my fault, i missed something in the code but the files been edited now.

For anyone else seeing 0's where a time stamp should be, this is because there is no date/time logged (pre-tracker). As soon as people visit the boards after the changes etc have been made, then it will start to display the stamps.
Title: Re: Tracking User Activity
Post by: schmooot on September 29, 2009, 05:25:35 PM
Tones file works for me perfectly.  I'm running 1.1.10
Title: Re: Tracking User Activity
Post by: haiwasnm on October 05, 2009, 07:42:00 AM
wow, i'm come back, this post is still popular
Title: Re: Tracking User Activity
Post by: edi67 on October 06, 2009, 08:46:35 AM
Quote from: Tones on September 12, 2009, 12:02:39 PM
I've made some changes to the tracker myself to include a few things i needed for what i'm using it for.  But i'm a tard and didnt save the message i sent to Mike with the changes, so i'm just attaching my file. For smf 1.1.10

Additional code to display the primary groups of those added to the watch list, I've also added time stamps and edit the existing code to work with that, and html to skin it which  will use the images from your forum template.

With this version though note i've limited the number of topics displayed to 50, with large communities we'd just end up with a mile long list but you can change this. And i'll include a small change you can make to the profile.php page to link the tracker through the track user link there.

Run these queries in phpmyadmin to add the logtime fields to the database tables we call the info from. Change the database prefix if yours differs.

ALTER TABLE `smf_log_boards` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE `smf_log_topics` ADD `logTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;



open the tracker.php file

On line 8 find

if (preg_match("/yoursite.com$/i", $_SERVER["HTTP_HOST"])) {

Replace yoursite.com with your domain

For the edit to link the tracker to the users profile

Open Sources/profile.php
find

$context['profile_areas']['info']['areas']['trackUser'] = '<a href="' . $scripturl . '?action=profile;u=' . $memID . ';sa=trackUser">' . $txt['trackUser'] . '</a>';


Replace with

$context['profile_areas']['info']['areas']['trackUser'] = '<a href="./tracker.php?function=track;u=' . $memID . '">' . $txt['trackUser'] . '</a>';


I think i remembered everything.

www.habitat-zaby.com/tracker.zip

(http://i180.photobucket.com/albums/x93/tonesrlc/tracker.jpg)

that trip work only for smf 1 ? because i have smf 2 and there isn't this line:
if (preg_match("/yoursite.com$/i", $_SERVER["HTTP_HOST"])) {

i have this:
if (preg_match("/(milnet|army|navy|air-force).ca$/i", $_SERVER["HTTP_HOST"])) {
Title: Re: Tracking User Activity
Post by: Tones on October 18, 2009, 11:45:58 AM
That's right my file will only work for 1. I havent begun to look at 2 yet as rc2 is released for charter members and differences with the curve template which i gotta admit looks awesome.
Title: Re: Tracking User Activity
Post by: Uhura! on October 27, 2009, 12:48:56 PM
Gosh, this is a great feature!

Does this work for 1.1.10?
Title: Re: Tracking User Activity
Post by: Arantor on October 27, 2009, 07:17:46 PM
The edits made by Tones work on 1.1.10 as stated.
Title: Re: Tracking User Activity
Post by: Uhura! on November 04, 2009, 12:39:21 PM
Nice!

Where are the controls / buttons in the Admin Panel?
Title: Re: Tracking User Activity
Post by: Arantor on November 04, 2009, 04:12:00 PM
If it's mostly the same as the first post, it explains that there isn't an admin panel, it's a standalone page.
Title: Re: Tracking User Activity
Post by: Uhura! on November 05, 2009, 10:35:08 AM
Thanks, I missed that.
Title: Re: Tracking User Activity
Post by: king kratos on November 05, 2009, 10:54:35 AM
This is a great tool! I'm going to have to try and tweak it a little for my own needs, but it is great!

Thank you for taking the time to create this.

Kratos
Title: Re: Tracking User Activity
Post by: king kratos on November 05, 2009, 11:19:25 AM
Edit: I made a very useful change that I want to share with everyone. (I had to make a new post because the edit wasn't displaying the code properly.)

Find:

echo "<br />Jump to: <a href=\"#boards\">Boards</a> || <a href=\"#topics\">Topics</a> || <a href=\"#monitor\">Monitored Topics</a> || <a href=\"#admin\">Admin Actions</a> || <a href=\"#errors\">Errors</a>";


Replace With:

echo "<br />Jump to: <a href=\"#boards\">Boards</a> || <a href=\"#topics\">Topics</a> || <a href=\"#monitor\">Monitored Topics</a> || <a href=\"#admin\">Admin Actions</a> || <a href=\"#errors\">Errors</a> || <a href=\"./tracker.php\">Tracker Home</a>";


All I added was "Tracker Home" to quickly get back the the front portion of the tracker page. NOTE: If you have changed the name of your tracker page (example: I changed the name of mine to "tracker_2_0.php), you need to reflect that change in the above "Replace With" code.

I hope this helps other as it has helped me. It is much easier when trying to track multiple users.

Kratos
Title: Re: Tracking User Activity
Post by: Uhura! on November 30, 2009, 09:28:07 AM
This mod rocks!

Question...

Why am I not gettig IP addresses and times with my tracking info? All I get is a list of rooms visited. :(
Title: Re: Tracking User Activity
Post by: Uhura! on November 30, 2009, 08:50:27 PM
Anyone have any advice?

Thanks!
Title: Re: Tracking User Activity
Post by: Uhura! on December 02, 2009, 01:27:23 PM
Anyone?

Bueller?  Bueller?
Title: Re: Tracking User Activity
Post by: H on December 02, 2009, 01:34:52 PM
What do you see in the 'Current Action' section?
Title: Re: Tracking User Activity
Post by: Uhura! on December 02, 2009, 08:37:05 PM
(http://i19.photobucket.com/albums/b193/Uhura1701/TrackUserActivity.jpg)
Title: Re: Tracking User Activity
Post by: Uhura! on December 11, 2009, 08:55:23 AM
Any luck looking @ this?

Thanks!
Title: Re: Tracking User Activity
Post by: Jamesviedigital on December 14, 2009, 12:53:49 PM
Thanks Mike

Nothing is more important today is tracking our visitors, good job mate, thanks

James
Title: Re: Tracking User Activity
Post by: Uhura! on December 14, 2009, 03:23:48 PM
:(
Title: Re: Tracking User Activity
Post by: seomul on December 17, 2009, 04:25:29 AM
Its good ... well done great going.
Title: Re: Tracking User Activity
Post by: gastan on December 30, 2009, 08:18:38 PM
comment deleted 1-09-10.  problem solved.
Title: Re: Tracking User Activity
Post by: CultureGlue on January 12, 2010, 09:56:36 AM
Quote from: Han on July 25, 2005, 06:30:10 PM
It comes in handy in all occasions when the admin needs to know if a user has read a certain topic.
I'm very pleased with it!!
That's for sure..
Title: Re: Tracking User Activity
Post by: Uhura! on January 12, 2010, 01:40:25 PM
This mod rocks!

Question...

Why am I not gettig IP addresses and times with my tracking info? All I get is a list of rooms visited. :(
Title: Re: Tracking User Activity
Post by: SoniaUK on January 13, 2010, 10:44:43 AM
Great mod

going to add it now.  ;)
Title: Re: Tracking User Activity
Post by: Tones on January 18, 2010, 04:40:52 AM
Quote from: Uhura! on January 12, 2010, 01:40:25 PM
This mod rocks!

Question...

Why am I not gettig IP addresses and times with my tracking info? All I get is a list of rooms visited. :(

Judging from the image you posted on the previous page, you're using the original file so havent made the adjustments to the database tables for logging times.
Title: Re: Tracking User Activity
Post by: Uhura! on January 18, 2010, 10:44:45 AM
So, it isn't enough to install the mod - I have to write code and install additional items myself?
Title: Re: Tracking User Activity
Post by: CultureGlue on January 18, 2010, 05:50:56 PM
Is it possible to make this work for an IP- address?
Title: Re: Tracking User Activity
Post by: zushiba on January 25, 2010, 04:33:20 PM
This is interesting. I did something similar for my forum overall back when I was using 1.9 (http://www.simplemachines.org/community/index.php?topic=313896.msg2082815#msg2082815) I like this very much, Thanks.
Title: Re: Tracking User Activity
Post by: CultureGlue on January 25, 2010, 07:54:27 PM
http://leftlogic.com/lounge/articles/jquery_spy/
Title: Re: Tracking User Activity
Post by: zushiba on January 26, 2010, 05:35:25 PM
Yes that is the code I used.
Title: Re: Tracking User Activity
Post by: CultureGlue on January 26, 2010, 10:04:40 PM
But here you sound that you create the code.. http://www.simplemachines.org/community/index.php?topic=313896.msg2082815#msg2082815
Title: Re: Tracking User Activity
Post by: zushiba on January 27, 2010, 10:45:44 AM
To connect to the SMF database and grab the necessary information then format for the display yes. That's not built in functionality to the jQuery spy. In fact I made it quite clear where I got it from.
QuoteI got the idea by looking at the Digg Spy (http://labs.digg.com/bigspy/). I wanted to do something like this for my forum (1.1.9) some googling produced http://leftlogic.com/lounge/articles/jquery_spy/ which uses jquery to nab the contents of whatever you point it at at a specific interval.
It took a very little modifying to get it to work with the forums. I used the smf_log_online table to get an idea of what people were up too.
thought I made it clear, certainly didn't mean to make it sound like I had coded the entire thing just the part that formats the SMF information for display.
EDIT: Updated code to actually close the sql connection.
Title: Re: Tracking User Activity
Post by: CultureGlue on January 28, 2010, 11:48:22 AM
I am sorry you are right..
Title: Re: Tracking User Activity
Post by: radiaku on January 29, 2010, 11:00:13 AM
Great Mod

But I think if its have css
maybe its will more cool
Title: Re: Tracking User Activity
Post by: Uhura! on January 29, 2010, 03:41:27 PM
I need some help. Mine doesn't show IP addresses :)

http://www.simplemachines.org/community/index.php?topic=36793.msg2386761#msg2386761
Title: Re: Tracking User Activity
Post by: Lorisplace on March 20, 2010, 01:00:51 AM
Quote from: Mike Bobbitt on May 24, 2005, 12:47:14 PM
I've created a simple script to track recent user activity on SMF. It's nothing fancy, but if you want to find out what people have been up to (useful for keeping tabs on potential trouble) you may find this handy.

This sounds nice Mike Bobbitt.

Can someone list exactly what activity is shown?

Thanks in advance.
Title: Re: Tracking User Activity
Post by: wtf_gamer on April 01, 2010, 02:53:04 PM
is there a link for tones version floating around?
Title: Re: Tracking User Activity
Post by: bucharest on April 19, 2010, 03:53:58 AM
How do i add this to my forum ?
Title: Re: Tracking User Activity
Post by: agraj1 on April 19, 2010, 11:10:54 AM
hello,
it can be really useful, it will definitely going to give an try. By this one can learn certain thing how it can target its user. Good work..!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on August 19, 2010, 03:48:14 PM
Lorisplace,

It shows a list of users who belong to a usergroup you specify. When you click on a user, it shows:

Boards || Topics || Monitored Topics || Admin Actions || Errors

Basically anything it can find for that user.

Uhura!, sorry for the (very) late reply... IP addresses are only shown for Admin Actions... are you seeing them there? In SMF 2 you can use the "Track User" feature under their profile to see what IP addresses they have used.


Cheers
Mike
Title: Re: Tracking User Activity
Post by: Robert. on October 07, 2010, 02:52:26 PM
Nice! :D *bookmarked*
Title: Re: Tracking User Activity
Post by: Autumn13 on January 01, 2011, 02:38:25 PM
The Admin before me had this so that there was a link on every member's profile. In Sources>Profile.php I have the following code
// Groups with moderator permissions can also....
if (allowedTo('moderate_forum'))
{
$context['profile_areas']['info']['areas']['trackUserActivity'] = '<a href="http://www.myforum.com/tracker.php?function=track;u=' . $memID . '">' . $txt['trackUserActivity'] . '</a>';

(I have my real URL of course)

There were other instances of where it was added, but I think this could be where the main problem is

So on the Profile page, I just have a blank space under the Profile Info of where the link should be. :\ Any help would be greatly appreciated. Thanks!
Title: Re: Tracking User Activity
Post by: flapjack on January 01, 2011, 02:58:33 PM
do you have some echo in profile.template.php to print it on screen?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 03, 2011, 03:56:14 PM
Also, do you have $txt['trackUserActivity'] defined somewhere? Could be that the URL has no text to link.
Title: Re: Tracking User Activity
Post by: Masterd on January 04, 2011, 08:24:09 AM
When you will modify this for SMF 2.0?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 04, 2011, 08:29:25 AM
It should work with 2.0 RC4 already. Are you having problems with it on 2.0?
Title: Re: Tracking User Activity
Post by: Masterd on January 04, 2011, 08:46:51 AM
No, I just didn't saw this:

Quote from: Mike Bobbitt on May 24, 2005, 12:47:14 PM
Update [10 July 2009]: A new version for SMF 2 is now available, see http://www.simplemachines.org/community/index.php?topic=36793.msg2153231#msg2153231

Sorry.  O:)
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 04, 2011, 08:49:28 AM
No worries, it was buried on page 12! I've updated the first post to have a link to the download.
Title: Re: Tracking User Activity
Post by: Autumn13 on January 21, 2011, 03:58:49 PM
My apologies, it appears I didn't have this set to notify me on new replies.
Quote from: flapjack on January 01, 2011, 02:58:33 PM
do you have some echo in profile.template.php to print it on screen?

No, it appears I do not. That is definitely the problem...however, I have no clue what to insert.


Quote from: Mike Bobbitt on January 03, 2011, 03:56:14 PM
Also, do you have $txt['trackUserActivity'] defined somewhere? Could be that the URL has no text to link.
Yes, I do.

I have 2 PHP files. One is simply Profile.php and the other is Profile.template.php. The Profile.php is where I have the code you have above, but it is missing from Profile.template.php.

Again, I'm not sure what code to put in Profile.template. Any help would be much appreciated! :)
Title: Re: Tracking User Activity
Post by: flapjack on January 21, 2011, 04:02:42 PM
if you can attach it here, I will have a look :)
Title: Re: Tracking User Activity
Post by: Autumn13 on January 21, 2011, 05:00:52 PM
Interesting...I do not have the ability to attach.  ???

You are so sweet! Thank you:)

http://www.2shared.com/file/EWRcuy_e/Profiletemplate.html
Title: Re: Tracking User Activity
Post by: flapjack on January 21, 2011, 05:15:18 PM
try this (see lines 42-50):
http://pastebin.com/WVD7GWDr
Title: Re: Tracking User Activity
Post by: Autumn13 on January 21, 2011, 08:14:47 PM
Thanks, but no it did not work:(
Title: Re: Tracking User Activity
Post by: flapjack on January 21, 2011, 08:38:53 PM
any clues? it should appear as the last item on the profile menu, is it not there?
also, is there any error in the log?
Title: Re: Tracking User Activity
Post by: Autumn13 on January 22, 2011, 03:55:13 AM
No, it is not there. It looks like there is a place for it, but it is blank.

Regarding error logs - well that is a bit of a problem. My host updated Apache server a month ago, and it completely threw my forum out of whack. My custom themes tripped thousands of errors. I am creating a new theme from default and I'm still getting a lot of errors...so I am not seeing anything that is out of place, because technically everything is :s I've been living a bit of a nightmare for the past month that I'm trying to unravel!
Title: Re: Tracking User Activity
Post by: Eyesman on January 23, 2011, 08:01:36 AM
Hi there,

I just installed this mod but it doesn't show any activity. All it shows is the following:
Track User Activity

This script tracks the recent actions of all users in The Watch List.

Is there a configuration page for this?

My smf is v.1.1.12 with the default theme.

Thank you.
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 23, 2011, 07:57:49 PM
Hi Eyesman,

No config page for it unfortunately, but you will want to change the group ID listed in the PHP file to match the group you want to monitor:

// Warning group IDs (primary)
$watchlist = "23";
Title: Re: Tracking User Activity
Post by: Eyesman on January 24, 2011, 12:36:29 AM
Hi Mike,

If I understand correctly I have to change it every time I need to track a user?

Thanx!
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on January 24, 2011, 09:57:37 AM
No, you just change the watch list group to the group ID you want to use, then add users to that group (as a secondary membership) and they will appear on the list.
Title: Re: Tracking User Activity
Post by: Jeet Chowdhury on January 28, 2011, 03:34:45 AM
i got this error,

Fatal error: Call to undefined function db_query() in /home/mobtalk/public_html/tracker.php on line 110
Title: Re: Tracking User Activity
Post by: Arantor on January 28, 2011, 03:36:32 AM
Quote from: Jeet Chowdhury on January 28, 2011, 03:34:45 AM
i got this error,

Fatal error: Call to undefined function db_query() in /home/mobtalk/public_html/tracker.php on line 110

You're using 2.0. This does not work on 2.0 and will need to be rewritten to work on 2.0.
Title: Re: Tracking User Activity
Post by: Jeet Chowdhury on January 28, 2011, 04:43:09 AM
ok thank you arantor for the answer. :)
Title: Re: Tracking User Activity
Post by: Masterd on January 28, 2011, 04:52:00 AM
This is working with the SMF 2.0.
Title: Re: Tracking User Activity
Post by: Arantor on January 28, 2011, 05:03:27 AM
Then why is it calling 1.1.x functions?
Title: Re: Tracking User Activity
Post by: Masterd on January 28, 2011, 01:43:42 PM
Then he downloaded the wrong file.

Since when $smcFunc is SMF 1.1.x function?
Title: Re: Tracking User Activity
Post by: Arantor on January 28, 2011, 05:25:32 PM
It isn't, never has been. $func is the equivalent in SMF 1.1.x, for some things and db_query() for others.
Title: Re: Tracking User Activity
Post by: Masterd on February 09, 2011, 06:41:18 AM
I know that. I'm just sarcastic.
Title: Re: Tracking User Activity
Post by: studiowi33 on July 02, 2011, 02:49:56 PM
How do u get this to work in 2.0 Gold?

I get a "Fatal error: Call to undefined function db_query() in /home/theozcc1/public_html/tracker.php on line 294".
Thanks for looking.
Title: Re: Tracking User Activity
Post by: Robert. on July 02, 2011, 03:48:27 PM
Quote from: studiowi33 on July 02, 2011, 02:49:56 PM
How do u get this to work in 2.0 Gold?

I get a "Fatal error: Call to undefined function db_query() in /home/theozcc1/public_html/tracker.php on line 294".
Thanks for looking.
This should work:
<?php


/*
$Id: tracker.php,v 1.29 2006/02/21 14:11:48 bobbitt Exp $

Written by Mike Bobbitt for Army.ca
*/

// Place this script in the same directory as SSI.php, or set the path below
if (file_exists(dirname(__FILE__).'/SSI.php')) {
$ssifile = dirname(__FILE__).'/SSI.php';
} else {
$ssifile = "/var/www/html/forums/SSI.php";
}

// Are we running on Army.ca or standalone?
if (preg_match("/army.ca$/i", $_SERVER["HTTP_HOST"])) {
$armyca = 1;
} else {
$armyca = 0;
}

if (
$armyca) {
include_once "/var/www/html/includes/header.php";
} else {
require ($ssifile);

// Set this to restrict access. Currently only admins are allowed.
$isstaff = $user_info['is_admin'];
}

// Make sure we have a DB prefix at least
if (!isset ($db_prefix)) {
$db_prefix = "`smf`.smf_";
}

// Database tables
// These are all default values, and should not need to be changed.
$db_member_table = "members";
$db_log_topics_table = "log_topics";
$db_message_table = "messages";
$db_topics_table = "topics";
$db_boards_table = "boards";
$db_log_boards_table = "log_boards";
$db_log_errors_table = "log_errors";
$db_log_notify_table = "log_notify";
$db_log_online_table = "log_online";
$db_log_actions_table = "log_actions";

// Make sure table name includes database name
$db_member_table = "$db_prefix$db_member_table";
$db_log_topics_table = "$db_prefix$db_log_topics_table";
$db_message_table = "$db_prefix$db_message_table";
$db_topics_table = "$db_prefix$db_topics_table";
$db_boards_table = "$db_prefix$db_boards_table";
$db_log_boards_table = "$db_prefix$db_log_boards_table";
$db_log_errors_table = "$db_prefix$db_log_errors_table";
$db_log_notify_table = "$db_prefix$db_log_notify_table";
$db_log_online_table = "$db_prefix$db_log_online_table";
$db_log_actions_table = "$db_prefix$db_log_actions_table";

if (!
$isstaff) {
echo "ERROR: You are not Army.ca Staff.";
if ($armyca) {
include "$include_dir/footer.php";
}
exit (1);
}

// download variables
if (isset ($_REQUEST["function"])) {
$function = $_REQUEST["function"];
}

if (isset (
$_REQUEST["u"])) {
$u = $_REQUEST["u"];
}

if (isset (
$_REQUEST["user"])) {
$user = $_REQUEST["user"];
}

echo
"<h1>User Tracker</h1>\n";
echo
"This script tracks the recent actions of all users in The Watch List.<br /><br />\n";

// Warning group IDs (primary)
$watchlist = "23";

// Show "lookup user" form
if (!$function) {
echo<<<HTML
<div class="highlight">Track User</div><br /><br />
<form>
Username, Display Name or User ID #: <input type="text" name="user" />
<input type="hidden" name="function" value="trackuser" />
<br />
<input type="submit" value="Track User">
</form>
<br />
HTML;
}

if (
$function == "trackuser") {
// it's a userid, not a username
if (preg_match("/^\d+$/", $user)) {
$u = $user;
} else {
// Generate query
$result = mysql_query("SELECT $db_member_table.`ID_MEMBER` FROM $db_member_table WHERE $db_member_table.`memberName` = \"$user\" OR $db_member_table.`realName` = \"$user\"", __FILE__, __LINE__);
$res = mysql_fetch_array($result);
$u = $res[0];
}

if (!$u) {
echo<<<HTML
<br />
<br />
WARNING: User
$user not found. Please search again.
<br />
<br />
HTML;
} else {
$function = "track";
}
}

// Track a user
if ($function == "track") {
// Get username again
$result = mysql_query("SELECT $db_member_table.`realName` FROM $db_member_table WHERE $db_member_table.`ID_MEMBER` = \"$u\"", __FILE__, __LINE__);
$res = mysql_fetch_array($result);
$realName = $res[0];
mysql_free_result($result);

echo "Tracking <a href=\"$scripturl?action=profile;u=$u\">$realName</a>...<br />\n";

echo "<br />Jump to: <a href=\"#boards\">Boards</a> || <a href=\"#topics\">Topics</a> || <a href=\"#monitor\">Monitored Topics</a> || <a href=\"#admin\">Admin Actions</a> || <a href=\"#errors\">Errors</a>";

echo "<a name=\"boards\"><h2>Current Action</h2></a>";

// Get the user's current action
$result = mysql_query("SELECT * FROM $db_log_online_table WHERE $db_log_online_table.`ID_MEMBER` = \"$u\" ORDER BY $db_log_online_table.`logTime` DESC LIMIT 1", __FILE__, __LINE__);

echo "<table>";

while ($res = mysql_fetch_array($result)) {
echo "<tr><td>";

// Decode current action
global $sourcedir;

include_once ("$sourcedir/Who.php");
echo determineActions($res['url']);

echo "</td><td>";
if ($res['logTime']) {
echo $res['logTime'];
}
echo "</td></tr>\n";
}
echo "</table>";
mysql_free_result($result);

echo "<a name=\"boards\"><h2>Recent Boards</h2></a>";

// Get the user's board log
$result = mysql_query("SELECT * FROM $db_log_boards_table WHERE $db_log_boards_table.`ID_MEMBER` = \"$u\"", __FILE__, __LINE__);

echo "<table>";

while ($res = mysql_fetch_array($result)) {
// Get the board title
$result2 = mysql_query("SELECT $db_boards_table.`name` FROM $db_boards_table WHERE $db_boards_table.`ID_BOARD` = \"$res[ID_BOARD]\"", __FILE__, __LINE__);
$res2 = mysql_fetch_array($result2);
$name = $res2[0];
mysql_free_result($result2);

echo "<tr><td><a href=\"$scripturl/board,$res[ID_BOARD].0.html\">$name</a></td><td>";
if ($res['logTime']) {
echo date("Y/m/d H:i:s", $res['logTime']);
}
echo "</td></tr>\n";
}
echo "</table>";
mysql_free_result($result);

echo "<a name=\"topics\"><h2>Recent Topics</h2></a>";

// Get the user's topic log
$result = mysql_query("SELECT * FROM $db_log_topics_table WHERE $db_log_topics_table.`ID_MEMBER` = \"$u\" ORDER BY $db_log_topics_table.`ID_TOPIC` DESC", __FILE__, __LINE__);

echo "<table>";

while ($res = mysql_fetch_array($result)) {
// Get the topic title
$result2 = mysql_query("SELECT $db_message_table.`subject` FROM $db_message_table WHERE $db_message_table.`ID_TOPIC` = \"$res[ID_TOPIC]\"", __FILE__, __LINE__);
$res2 = mysql_fetch_array($result2);
$subject = $res2[0];
mysql_free_result($result2);

echo "<tr><td><a href=\"$scripturl/topic,$res[ID_TOPIC].0.html\">$subject</a></td><td>";
if ($res['logTime']) {
echo date("Y/m/d H:i:s", $res['logTime']);
}
echo "</td></tr>\n";
}
echo "</table>";
mysql_free_result($result);

echo "<a name=\"monitor\"><h2>Monitored Topics/Boards</h2></a>";

// Get the user's notifications list
$result = mysql_query("SELECT * FROM $db_log_notify_table WHERE $db_log_notify_table.`ID_MEMBER` = \"$u\"", __FILE__, __LINE__);

while ($res = mysql_fetch_array($result)) {
// Get the topic title
if ($res[ID_TOPIC]) {
$result2 = mysql_query("SELECT $db_message_table.`subject` FROM $db_message_table WHERE $db_message_table.`ID_TOPIC` = \"$res[ID_TOPIC]\"", __FILE__, __LINE__);
$res2 = mysql_fetch_array($result2);
$subject = $res2[0];

if (!$subject) {
$subject = "Not a valid topic.";
}
mysql_free_result($result2);
echo "<a href=\"$scripturl/topic,$res[ID_TOPIC].0.html\">$subject</a><br />\n";
}

if ($res[ID_BOARD]) {
// Get the board title
$result2 = mysql_query("SELECT $db_boards_table.`name` FROM $db_boards_table WHERE $db_boards_table.`ID_BOARD` = \"$res[ID_BOARD]\"", __FILE__, __LINE__);
$res2 = mysql_fetch_array($result2);
$subject = $res2[0];
mysql_free_result($result2);
echo "<a href=\"$scripturl/board,$res[ID_BOARD].0.html\">$subject</a><br />\n";
}
}
mysql_free_result($result);

echo "<a name=\"admin\"><h2>Admin Actions</h2></a>";

// Get the user's admin actions log
$result = mysql_query("SELECT * FROM $db_log_actions_table WHERE $db_log_actions_table.`ID_MEMBER` = \"$u\" ORDER BY $db_log_actions_table.`logTime` ASC", __FILE__, __LINE__);

echo<<<HTML
<table>
<tr>
<th>Datestamp</th><th>Action</th><th>Details</th><th>IP Address</th>
</tr>
HTML;

while ($res = mysql_fetch_array($result)) {
echo "<tr><td>";
echo date("Y/m/d H:i:s", $res['logTime'])."</td><td>";
echo $res['action']."</td><td>";
include_once ("$sourcedir/Who.php");
echo determineActions($res['extra'])."</td><td>";
echo $res['ip']."</td><td>";
echo "</tr>";
}
mysql_free_result($result);
echo "</table>";

echo "<a name=\"errors\"><h2>Recent Errors</h2></a>";

// Get the user's error log
$result = mysql_query("SELECT * FROM $db_log_errors_table WHERE $db_log_errors_table.`ID_MEMBER` = \"$u\" ORDER BY $db_log_errors_table.`logTime` DESC", __FILE__, __LINE__);

echo "<table>";

while ($res = mysql_fetch_array($result)) {
echo "<tr><td>$res[message]</td><td>";
echo date("Y/m/d H:i:s", $res[logTime]);
echo "</td></tr>\n";
}
echo "</table>";
mysql_free_result($result);

if ($armyca) {
include_once "$include_dir/footer.php";
}
exit (0);
}

// Get list of users in The Watch List
if ($armyca) {
$result = mysql_query("SELECT * FROM $db_member_table WHERE $db_member_table.`additionalGroups` LIKE \"%$watchlist%\"", __FILE__, __LINE__);

echo "Select the user you want to track:<br /><br />\n";

while ($res = mysql_fetch_array($result)) {
echo "<a href=\"$scripturl?action=profile;u=$res[ID_MEMBER]\"><img align=\"middle\" src=\"http://army.ca/forums/Themes/Armyca/images/icons/profile_sm.gif\" border=\"0\"></a> <a href=\"?function=track;u=$res[ID_MEMBER]\">$res[realName]</a><br />\n";
}

mysql_free_result($result);

include "$include_dir/footer.php";
}
?>
Title: Re: Tracking User Activity
Post by: studiowi33 on July 02, 2011, 10:01:29 PM
thanks Doc, but(!)...

It doesn't show who's online (like it used to,) so i imputted my own user ID and got these:
User Tracker
This script tracks the recent actions of all users in The Watch List.


Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 131

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 132

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 134
Tracking ...

Jump to: Boards || Topics || Monitored Topics || Admin Actions || Errors
Current Action

Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 143

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 147

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 163
Recent Boards

Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 168

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 172

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 186
Recent Topics

Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 191

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 195

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 209
Monitored Topics/Boards

Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 214

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 216

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 239
Admin Actions

Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 244

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 253

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 262
Datestamp Action Details IP Address
Recent Errors

Warning: Wrong parameter count for mysql_query() in /home/theozcc1/public_html/Ztracker.php on line 268

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 272

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/theozcc1/public_html/Ztracker.php on line 278


I appreciate the effort Doc, just isn't working :(

EDIT: After reverting to the original tracker.php file, this is the contents of line 289...

$result = db_query("SELECT $db_member_table.realName, $db_member_table.ID_MEMBER FROM $db_log_online_table, $db_member_table WHERE $db_log_online_table.ID_MEMBER = $db_member_table.ID_MEMBER ORDER BY $db_log_online_table.`logTime` DESC", __FILE__, __LINE__);

I can't see any online users to track and before upgrading to 2.0, I was able to simply click on the name. It kinda works now, but I have to manually enter a User ID into the "Track User" form.

(Sorry if I'm dense about this, it's a great feature.)

(http://img41.imageshack.us/img41/2873/tua.png) (http://imageshack.us/photo/my-images/41/tua.png/)

Uploaded with ImageShack.us (http://imageshack.us)
Title: Re: Tracking User Activity
Post by: Martine M on August 19, 2011, 04:41:37 PM
Thanks for the script I installed it, will let you know how it works.
Title: Re: Tracking User Activity
Post by: Justin se on August 24, 2011, 07:50:19 AM
nice script.
i'll install it later to my website...
Title: Re: Tracking User Activity
Post by: Martine M on August 24, 2011, 07:52:06 AM
It works great. :)
Title: Re: Tracking User Activity
Post by: tacosfitnessblog on August 27, 2011, 08:27:53 AM
works great, thx ::)
Title: Re: Tracking User Activity
Post by: Astarta on January 02, 2012, 06:05:25 PM
The mod is great! Thank you for your work!
I've tested it with 2.0.2 and it works like a charm!
I've only one question still...
Is it possible to log topic's views only it certain board?
I've looked on tvl_log function (in Sources/TopicViewLog.php), but I do not see the way to accomplish this task. I know the board ID, but how to use it...
Title: Re: Tracking User Activity
Post by: kasparh on January 15, 2012, 10:51:02 AM
i'm givingv a try on my forum, and it works great doing the job, but i have this error displayed

(http://63.imagebam.com/download/IRo3F6pKcPLfi4-jg9KoLQ/16992/169917175/tracker.jpeg)

any idea ?

sorry for the link on imagebam, but i can't attach files
Title: Re: Tracking User Activity
Post by: Chalky on February 29, 2012, 04:16:29 PM
I just installed this on my SMF 2.0.2 but when I type in a username I get the error:

"Fatal error: Call to undefined function db_query() in /home/content/28/74****8/html/sabrinova/tracker.php on line 110"

How do I make it work?
Title: Re: Tracking User Activity
Post by: Chalky on March 03, 2012, 06:41:38 PM
My line 110 is this if that helps:

      $result = db_query("SELECT $db_member_table.`ID_MEMBER` FROM $db_member_table WHERE $db_member_table.`memberName` = \"$user\" OR $db_member_table.`realName` = \"$user\"", __FILE__, __LINE__);
Title: Re: Tracking User Activity
Post by: XHIBIT911 on March 10, 2012, 09:37:45 AM
I uploaded this and got an error saying this package was empty
Title: Re: Tracking User Activity
Post by: MetalMusicMan on March 13, 2012, 10:38:24 AM
Thanks :)
Title: Re: Tracking User Activity
Post by: Chalky on March 18, 2012, 04:50:40 AM
Quote from: Sabrinova on February 29, 2012, 04:16:29 PM
I just installed this on my SMF 2.0.2 but when I type in a username I get the error:

"Fatal error: Call to undefined function db_query() in /home/content/28/74****8/html/sabrinova/tracker.php on line 110"

How do I make it work?

Ok just reealised my error - doh!!  I had downloaded the original file rather than the v2 update on page 12.  It's working now!
Title: Re: Tracking User Activity
Post by: matricrsult on April 24, 2012, 03:42:23 AM
hmmm i was looking for that thanks for sharing
Title: Re: Tracking User Activity
Post by: llyon on April 21, 2013, 04:18:23 AM
This is great but I get the following errors:


( ! ) Notice: Undefined variable: function in Z:\wamp\www\tracker.php on line 61
Call Stack
#   Time   Memory   Function   Location
1   0.0025   173856   {main}( )   ..\tracker.php:0

( ! ) Notice: Undefined variable: function in Z:\wamp\www\tracker.php on line 74
Call Stack
#   Time   Memory   Function   Location
1   0.0025   173856   {main}( )   ..\tracker.php:0

( ! ) Notice: Undefined variable: function in Z:\wamp\www\tracker.php on line 101
Call Stack
#   Time   Memory   Function   Location
1   0.0025   173856   {main}( )   ..\tracker.php:0

Any ideas?
Title: Re: Tracking User Activity
Post by: blevok on March 16, 2016, 02:42:00 PM
I just found this, and it's very useful and working good on 2.0.11

I wanted to be the only one that can access it, despite there being other admins, so i changed this:
// Set this to restrict access. Currently only admins are allowed.
$isstaff = $context['user']['is_admin'];
}
if (!$isstaff)
{
echo "ERROR: You are not an admin - ACCESS DENIED. ($isstaff)";


to this:
// Set this to restrict access to one user only.  Set $allowedid to the user you want to have access.
}
$allowedid = '3';
{
    if ($context['user']['id'] != $allowedid) {
echo "ERROR: ACCESS DENIED.";
Title: Re: Tracking User Activity
Post by: Deprecated on March 16, 2016, 05:54:41 PM
Another trick is to create another Admin group and make your other admins faux Admins, then set their permissions such as to give them everything except what you want them to keep their fingers off of.

Technically there is no real Admin group since a real Admin has ALL privileges. By creating a named Admin permission group you can give them what you want and only what you want.
Title: Re: Tracking User Activity
Post by: Grammy on July 25, 2016, 10:53:34 AM
Downloading the updated file for 2.0 and simply dropping the file (as is) into my forum's root, where the SSI.php lives, results in a blank page.  I see that others with 2.0.11 have been successful:

http://www.simplemachines.org/community/index.php?topic=36793.msg3865821#msg3865821 (http://www.simplemachines.org/community/index.php?topic=36793.msg3865821#msg3865821)

Mike Bobbitt, we hardly knew ye!   :D

Hope you stop by, or someone with some know-how can walk me through this.  I've been looking for a way to track user activity for a long time and this is the only thing I've found (other than current activity, that goes away when the user logs off).
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on July 25, 2016, 01:09:58 PM
What does your web server error log say? Usually a blank page is HTTP 500 which means PHP threw an error. With any luck your host is configured to include some of that info in the logs.
Title: Re: Tracking User Activity
Post by: Grammy on July 25, 2016, 02:06:40 PM
Quote from: Mike Bobbitt on July 25, 2016, 01:09:58 PM
What does your web server error log say? Usually a blank page is HTTP 500 which means PHP threw an error. With any luck your host is configured to include some of that info in the logs.

Mike Bobbitt, you're real!  (I thought you were one of those legendary posters who had ridden off into the sunset.)   :D

Well, that's the odd thing; there are no errors at all in my server logs since July 23rd.  I have nothing for today, at all.  Odd. 
I didn't edit the file at all; I just unzipped it and uploaded it into my forum's root.  It's 2.0.11 default, but I saw where someone else with 2.0.11 has it working.  I'll try it on another forum to see if it behaves the same. 


Hmmm...   I have three forums; one production and two test.  They're all hosted on the same dedicated server (Codero).  The tracker works on only one test forum.  It happens to be the one with no portal and hardly any mods, so I'm guessing I've got mod interference?
Title: Re: Tracking User Activity
Post by: Mike Bobbitt on July 25, 2016, 02:37:34 PM
I'm using it on 2.0.11 with no issues, I updated the zip with the file I was using (there were very minor changes):

http://army.ca/deleteme/tracker.zip

If it's in the same dir as SSI.php it "should" work. If you have console access, you can run it on the command line and see if it pops out any errors, E.G.:

[root@thunderdome 14] deleteme >                  php -f tracker.php
PHP Notice:  Undefined index: HTTP_HOST in /path/to/deleteme/tracker.php on line 22
PHP Warning:  require(/var/www/html/forums/SSI.php): failed to open stream: No such file or directory in /path/to/deleteme/tracker.php on line 31
PHP Fatal error:  require(): Failed opening required '/var/www/html/forums/SSI.php' (include_path='.:/usr/share/pear:/usr/share/php') in /path/to/deleteme/tracker.php on line 31


Title: Re: Tracking User Activity
Post by: Grammy on July 25, 2016, 03:02:51 PM
Aha.....   all I'm getting (but at least I'm getting something) is

Error 500 GET /bucket/tracker.php HTTP/1.1

I'm just sitting here blinking at it; I'm not sure what that means....   :-\

(That's with your latest zip.)
Title: Re: Tracking User Activity
Post by: Grammy on July 25, 2016, 03:09:41 PM
Wait.....  I fired it up in Firefox and got this:

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.
Title: Re: Tracking User Activity
Post by: Grammy on July 26, 2016, 04:17:52 PM
Quote from: Grammy on July 25, 2016, 03:09:41 PM
Wait.....  I fired it up in Firefox and got this:

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.


*little 24-hour bump*

So I was wondering...  Am I meant to edit the Tracker file with some sort of charset?  It doesn't have a head tag, so I'm uncertain of how to do that in a PHP file.   :-\
Title: Re: Tracking User Activity
Post by: johnlegend on October 19, 2017, 12:54:50 AM
This is exactly what I'm looking for. I have installed and play with it. Thanks!
Title: Re: Tracking User Activity
Post by: efk on October 19, 2017, 12:42:53 PM
I can't find this mod on mod list?
Title: Re: Tracking User Activity
Post by: d3vcho on October 19, 2017, 01:05:21 PM
Quote from: Mike Bobbitt on May 24, 2005, 12:47:14 PM
You can download the files from here: http://army.ca/deleteme/tracker.zip
Title: Re: Tracking User Activity
Post by: dougiefresh on November 17, 2017, 03:42:41 PM
@Mike Bobbitt:  Was wonderinf if I could get your permission to make this script into a proper mod, complete with permissions and a profile entry?  Thanks for your consideration!
Title: Re: Tracking User Activity
Post by: mousetemple on October 08, 2018, 05:44:30 PM
Wondering if this should still work on 2.0.15?

When i try to use it i get the following:
Track User Activity
This script tracks the recent actions of all users in The Watch List.

An Error Has Occurred!
The database value you're trying to insert does not exist: id_member
Back

Thanks
Title: Re: Tracking User Activity
Post by: Prisluskivaci on October 23, 2018, 04:05:00 PM
Works very well with update.
Title: Re: Tracking User Activity
Post by: MoonCat on April 09, 2021, 01:06:51 AM
I have this tracker installed. It works well, except it doesn't show the timestamp of the visit.

I'm using tracker.php from page 12 for SMF 2.0

Does anyone know how to fix it?

Thanks
Title: Re: Tracking User Activity
Post by: Zeblan on April 27, 2021, 12:17:49 PM
It's problem to install !! Fix error.
Title: Re: Tracking User Activity
Post by: shadav on April 27, 2021, 01:17:45 PM
Quote from: Zeblan on April 27, 2021, 12:17:49 PM
It's problem to install !! Fix error.
um....and how is this going to help

what exactly do you expect to happen with this type of post? How do you expect to get any kind of support at all with "It's problem to install !! Fix error." what does this tell us? Nothing!

How about telling us what the error that you received was....
How about telling us what version of smf you are using?
How about telling us what other mods you have installed?
Just to begin with...there may be other things we might need to know after this to help you.

[edit] lmfao um how is it a problem to install, you just download the file, unzip the file, then upload to your smf root folder (the same place that setttings.php is).... couldn't be easier to install.
Title: Re: Tracking User Activity
Post by: ehpoulsen on September 06, 2021, 03:05:26 PM
It looks great! I will try it right away to see, if I can get it to work in the same way!
Title: Re: Tracking User Activity
Post by: Doug Heffernan on January 30, 2022, 05:40:01 PM
Quote from: shadav on April 27, 2021, 01:17:45 PM
Quote from: Zeblan on April 27, 2021, 12:17:49 PMIt's problem to install !! Fix error.
um....and how is this going to help

what exactly do you expect to happen with this type of post? How do you expect to get any kind of support at all with "It's problem to install !! Fix error." what does this tell us? Nothing!

How about telling us what the error that you received was....
How about telling us what version of smf you are using?
How about telling us what other mods you have installed?
Just to begin with...there may be other things we might need to know after this to help you.

[edit] lmfao um how is it a problem to install, you just download the file, unzip the file, then upload to your smf root folder (the same place that setttings.php is).... couldn't be easier to install.

Sorry to bump this topic, but the post quoted by @shadav is actually one of posts that I had in mind when I started the mnetalo topic :D

I think that will solve this kind of problem for you in the future shadav. :D

https://www.simplemachines.org/community/index.php?topic=580449.msg4108862#msg4108862