FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Logging Group Manager actions
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Logging Group Manager actions [message #164072] Sun, 02 January 2011 19:54 Go to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma:
Senior Member
Just a first step since I felt like it Razz

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


[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Database host:port support
Next Topic: Fudforum on Foswiki appliance
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 00:04:15 GMT 2024

Total time taken to generate the page: 0.05447 seconds