event_log_track_user.module in Events Log Track 8
Same filename and directory in other branches
Logs user CUD commands in the event_log_track module.
File
event_log_track_user/event_log_track_user.moduleView source
<?php
/**
* @file
* Logs user CUD commands in the event_log_track module.
*/
/**
* Implements hook_event_log_track_handlers().
*/
function event_log_track_user_event_log_track_handlers() {
// User event log handler.
$handlers = array();
$handlers['user'] = array(
'title' => t('User'),
);
return $handlers;
}
/**
* Implements hook_user_insert().
*/
function event_log_track_user_insert($account) {
$log = array(
'type' => 'user',
'operation' => 'insert',
'description' => t('%name (uid %uid)', array(
'%name' => $account
->getUsername(),
'%uid' => $account
->id(),
)),
'ref_numeric' => $account
->id(),
'ref_char' => $account
->getUsername(),
);
event_log_track_insert($log);
}
/**
* Implements hook_user_update().
*/
function event_log_track_user_update($account) {
$log = array(
'type' => 'user',
'operation' => 'update',
'description' => t('%name (uid %uid)', array(
'%name' => $account->original
->getUsername(),
'%uid' => $account->original
->id(),
)),
'ref_numeric' => $account->original
->id(),
'ref_char' => $account
->getUsername(),
);
event_log_track_insert($log);
}
/**
* Implements hook_user_delete().
*/
function event_log_track_user_delete($account) {
$log = array(
'type' => 'user',
'operation' => 'delete',
'description' => t('%name (uid %uid)', array(
'%name' => $account
->getUsername(),
'%uid' => $account
->id(),
)),
'ref_numeric' => $account
->id(),
'ref_char' => $account
->getUsername(),
);
event_log_track_insert($log);
}
Functions
Name | Description |
---|---|
event_log_track_user_delete | Implements hook_user_delete(). |
event_log_track_user_event_log_track_handlers | Implements hook_event_log_track_handlers(). |
event_log_track_user_insert | Implements hook_user_insert(). |
event_log_track_user_update | Implements hook_user_update(). |