Logging Group Manager actions [message #164072] |
Sun, 02 January 2011 19:54 |
Ernesto
Messages: 413 Registered: August 2005
Karma: 0
|
Senior Member |
|
|
Just a first step since I felt like it
In admlog.php
After
case "ADDFORUM":
echo '<td>Created Forum</td><td>forum: '.return_forum_name($obj->a_res_id).'</td>';
break;
insert
case "ADDGRP":
echo '<td>Added groupmember</td><td>'.$obj->logaction.'</td>';
break;
case "DELGRP":
echo '<td>Deleted groupmember</td><td>'.$obj->logaction.'</td>';
break;
case "EDITGRP":
echo '<td>Edited groupmember</td><td>'.$obj->logaction.'</td>';
break;
In groupmgr.php.t
After
if (isset($_POST['btn_submit'])) {
insert
fud_use('logaction.inc');
After
q('INSERT INTO {SQL_TABLE_PREFIX}group_members (group_members_opt, user_id, group_id) VALUES ('.$perm.', '.$usr_id.', '.$group_id.')');
insert
$user_alias = q_singleval("SELECT alias FROM {SQL_TABLE_PREFIX}users WHERE id=".$usr_id);
$group_name = q_singleval("SELECT name FROM {SQL_TABLE_PREFIX}groups WHERE id=".$group_id);
$log_add_grp = 'Added member '.$user_alias.' ('.$usr_id.') to group '.$group_name.' ('.$group_id.')';
logaction(_uid, 'ADDGRP', 0, $log_add_grp);
after
q('UPDATE {SQL_TABLE_PREFIX}group_members SET group_members_opt='.$perm.' WHERE id='.(int)$_POST['edit']);
insert $user_alias = q_singleval("SELECT alias FROM {SQL_TABLE_PREFIX}users WHERE id=".$usr_id);
$group_name = q_singleval("SELECT name FROM {SQL_TABLE_PREFIX}groups WHERE id=".$group_id);
$log_edit_grp = 'Edit member '.$user_alias.' ('.$usr_id.') in group '.$group_name.' ('.$group_id.')';
logaction(_uid, 'EDITGRP', 0, $log_edit_grp);
After
if (isset($_GET['del']) && ($del = (int)$_GET['del']) && $group_id && sq_check(0, $usr->sq)) {
insert
fud_use('logaction.inc');
After
$is_gl = q_singleval("SELECT user_id FROM {SQL_TABLE_PREFIX}group_members WHERE group_id=".$group_id." AND user_id=".$del." AND group_members_opt>=131072 AND (group_members_opt & 131072) > 0");
insert
$user_alias = q_singleval("SELECT alias FROM {SQL_TABLE_PREFIX}users WHERE id=".$del);
$group_name = q_singleval("SELECT name FROM {SQL_TABLE_PREFIX}groups WHERE id=".$group_id);
$log_del_grp = 'Deleted member '.$user_alias.' ('.$del.') from group '.$group_name.' ('.$group_id.')';
logaction(_uid, 'DELGRP', 0, $log_del_grp);
This should add entries to the action log whenever someone adds, edits or deletes a groupmember
Ginnunga Gaming
|
|
|
|
|
|
|
|
|
|