News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Tracking User Activity

Started by Mike Bobbitt, May 24, 2005, 12:47:14 PM

Previous topic - Next topic

Mike Bobbitt

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;

Tones

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

schmooot

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 [nofollow] 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


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

Tones

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.

schmooot

Tones file works for me perfectly.  I'm running 1.1.10

haiwasnm

wow, i'm come back, this post is still popular

edi67

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



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"])) {
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Tones

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.

Uhura!

Gosh, this is a great feature!

Does this work for 1.1.10?
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Arantor

The edits made by Tones work on 1.1.10 as stated.

Uhura!

Nice!

Where are the controls / buttons in the Admin Panel?
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Arantor

If it's mostly the same as the first post, it explains that there isn't an admin panel, it's a standalone page.

Uhura!

:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

king kratos

#253
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

king kratos

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

Uhura!

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. :(
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Uhura!

Anyone have any advice?

Thanks!
:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Uhura!

:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

H

What do you see in the 'Current Action' section?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Uhura!

:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Advertisement: