• Welcome to Simple Machines Community Forum. Please login or sign up.

Tracking User Activity

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

Previous topic - Next topic

Mike Bobbitt

You can put it anywhere, so long as the SSI.php path at the top of the file is correct.

Skhilled

Thanks, Mike. Will give it a try.

Dem0n

August 31, 2005, 03:51:12 PM #22 Last Edit: August 31, 2005, 04:53:15 PM by Dem0n
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.


Mike Bobbitt

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.

Dem0n

I edited the other post and i figured that out..lol

Mike Bobbitt

Yeah, and I blindly replied based on the contents of the notification e-mail, then when I looked, I noticed the question was different. ;)

Dem0n

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!


Harelin

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?

Mike Bobbitt

September 04, 2005, 08:16:34 AM #28 Last Edit: September 04, 2005, 09:20:59 PM by Mike Bobbitt
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

Harelin

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.

Mike Bobbitt

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.

Harelin

September 04, 2005, 08:31:18 PM #31 Last Edit: September 04, 2005, 08:33:31 PM by Harelin
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.

Mike Bobbitt

Found an error in the code... replace "$board=$res[1];" with "$board=$res2[1];" and you should have better results.

Harelin

That fixed the board ID not displaying correctly, but the two boards I'm trying to exclude are still visible.

Mike Bobbitt

What's your if statement look like? E.G.:

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

What board IDs are you trying to hide?

Harelin

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.

Mike Bobbitt

Ok, that all looks good... How is $isstaff set, you mentioned you made some changes there...

Harelin

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'];"

Mike Bobbitt

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")

Egg


Advertisement: