From 20a2f7596cc47b31426bc8a56feea9dc8b5c5e99 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Tue, 28 Feb 2012 14:46:55 +0800 Subject: [PATCH 1/2] MDL-28387 logs: Log data when a user is deleted --- lib/moodlelib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 5cf9d50d8a5..aa3d3ac5ce5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -3878,6 +3878,9 @@ function delete_user($user) { $updateuser->timemodified = time(); $DB->update_record('user', $updateuser); + // Add this action to log + add_to_log(SITEID, 'user', 'delete', "view.php?id=$user->id", $user->firstname.' '.$user->lastname); + // We will update the user's timemodified, as it will be passed to the user_deleted event, which // should know about this updated property persisted to the user's table. From bf9f1bbd5e7c85ad1df1278e180ab2a1646b6bac Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Wed, 29 Feb 2012 14:06:12 +0800 Subject: [PATCH 2/2] MDL-28387 logs: Rearranging the log record for readability --- lib/db/log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/db/log.php b/lib/db/log.php index 4814f7d41c9..7549e34ec22 100644 --- a/lib/db/log.php +++ b/lib/db/log.php @@ -29,7 +29,6 @@ defined('MOODLE_INTERNAL') || die(); global $DB; // TODO: this is a hack, we should really do something with the SQL in SQL tables $logs = array( - array('module'=>'user', 'action'=>'view', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), array('module'=>'course', 'action'=>'user report', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), array('module'=>'course', 'action'=>'view', 'mtable'=>'course', 'field'=>'fullname'), array('module'=>'course', 'action'=>'update', 'mtable'=>'course', 'field'=>'fullname'), @@ -49,4 +48,5 @@ $logs = array( array('module'=>'group', 'action'=>'view', 'mtable'=>'groups', 'field'=>'name'), array('module'=>'tag', 'action'=>'update', 'mtable'=>'tag', 'field'=>'name'), array('module'=>'tag', 'action'=>'flag', 'mtable'=>'tag', 'field'=>'name'), + array('module'=>'user', 'action'=>'view', 'mtable'=>'user', 'field'=>$DB->sql_concat('firstname', "' '" , 'lastname')), );