Advertisement:
NameCheap

Author Topic: Tracking User Activity  (Read 232078 times)

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #20 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.

Offline Skhilled

  • Full Member
  • ***
  • Posts: 484
  • Gender: Male
  • Logo Off Admin
Re: Tracking User Activity
« Reply #21 on: August 22, 2005, 07:48:05 AM »
Thanks, Mike. Will give it a try.

Offline Dem0n

  • Full Member
  • ***
  • Posts: 520
  • Gender: Male
  • Word Lyfe!
    • TheTVStop
Re: Tracking User Activity
« Reply #22 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.

« Last Edit: August 31, 2005, 04:53:15 PM by Dem0n »

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #23 on: August 31, 2005, 04:55:39 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.

Offline Dem0n

  • Full Member
  • ***
  • Posts: 520
  • Gender: Male
  • Word Lyfe!
    • TheTVStop
Re: Tracking User Activity
« Reply #24 on: August 31, 2005, 04:57:28 PM »
I edited the other post and i figured that out..lol

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #25 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. ;)

Offline Dem0n

  • Full Member
  • ***
  • Posts: 520
  • Gender: Male
  • Word Lyfe!
    • TheTVStop
Re: Tracking User Activity
« Reply #26 on: August 31, 2005, 08:14:24 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!


Offline Harelin

  • Semi-Newbie
  • *
  • Posts: 88
  • Gender: Male
Re: Tracking User Activity
« Reply #27 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?

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #28 on: September 04, 2005, 08:16:34 AM »
Find this bit:


Quote
        while ($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:


Quote
        while ($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
« Last Edit: September 04, 2005, 09:20:59 PM by Mike Bobbitt »

Offline Harelin

  • Semi-Newbie
  • *
  • Posts: 88
  • Gender: Male
Re: Tracking User Activity
« Reply #29 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.

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #30 on: September 04, 2005, 08:20:16 PM »
Try this then, change:

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

to

Quote
echo "<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.

Offline Harelin

  • Semi-Newbie
  • *
  • Posts: 88
  • Gender: Male
Re: Tracking User Activity
« Reply #31 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.
« Last Edit: September 04, 2005, 08:33:31 PM by Harelin »

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #32 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.

Offline Harelin

  • Semi-Newbie
  • *
  • Posts: 88
  • Gender: Male
Re: Tracking User Activity
« Reply #33 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.

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #34 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?

Offline Harelin

  • Semi-Newbie
  • *
  • Posts: 88
  • Gender: Male
Re: Tracking User Activity
« Reply #35 on: September 04, 2005, 10:31:30 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.

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #36 on: September 04, 2005, 10:33:22 PM »
Ok, that all looks good... How is $isstaff set, you mentioned you made some changes there...

Offline Harelin

  • Semi-Newbie
  • *
  • Posts: 88
  • Gender: Male
Re: Tracking User Activity
« Reply #37 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'];"

Offline Mike Bobbitt

  • Full Member
  • ***
  • Posts: 574
    • Army.ca
Re: Tracking User Activity
« Reply #38 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")

Offline Egg

  • Full Member
  • ***
  • Posts: 519
  • Gender: Male
  • Busahead
    • 200mph.org.uk
Re: Tracking User Activity
« Reply #39 on: September 25, 2005, 06:25:50 AM »
would this work on 1.1RC1 ??