Tracking User Activity

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

Previous topic - Next topic

edi67

sorry but how i can permit to another usergroup to use this tracker?

help me please
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Smurfbutcher Bob

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.

ディン1031

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
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

edi67

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 :)
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

ディン1031

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
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

edi67

excellent and perfect thx din  ;)
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

1948Pal

#146
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]
"No matter how long the river, the river will reach the sea".
Eugene Fitch Ware

babjusi

Where can I download this mod please?

Mike Bobbitt


babjusi

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

veldfire

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

Mike Bobbitt

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.

veldfire


drzen

Wha's about tracking pm activies? (e.g. number of pm send)

Any idea?

dr

ディン1031

That's something what is agains the smf condition. A PM is something privat and should be privat.

Bye
DIN1031
Support only via MOD Thread! NO PM Support!
My Forum: ayu][kult Forum
My Mods: My Small Mod Collection
My Parser: DIN1031's ModParser
Current Info: More away the next days, because i've to much work to do :x

babjusi

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

rbdesign

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.

ladynada

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
WORK for Truth, Print it, Take Time to READ ALL LINKS NOTED  click here --> The TWO Witnesses are Mom and Dad and SMF Skins

Smurfbutcher Bob

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

ladynada

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
WORK for Truth, Print it, Take Time to READ ALL LINKS NOTED  click here --> The TWO Witnesses are Mom and Dad and SMF Skins

Advertisement: