PluginProbe
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity / 1.0
Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity v1.0
3.3.8 trunk 1.0 1.1.0 1.10.0 1.11.0 1.11.1 1.12.0 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.2.0 1.20.0 1.20.1 1.3.0 1.3.1 1.4.0 1.5.0 1.6.0 1.6.1 All 66 releases
logtivity / Logs / Core / Logtivity_User.php

Logtivity_User.php in Activity Logs, User Activity Tracking, Multisite Activity Log from Logtivity 1.0, at Logs/Core/Logtivity_User.php

58 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Logtivity_User extends Logtivity_Abstract_Logger
4 {
5 public function registerHooks()
6 {
7 add_action('wp_login', [$this, 'userLoggedIn'], 10, 2);
8 add_action('wp_logout', [$this, 'userLoggedOut']);
9 add_action( 'user_register', [$this, 'userCreated'], 10, 1 );
10 add_action( 'delete_user', [$this, 'userDeleted'] );
11 add_action( 'profile_update', [$this, 'profileUpdated'], 10, 2 );
12 }
13
14 public function userLoggedIn( $user_login, $user )
15 {
16 return Logtivity_Logger::log('User Logged In', null, $user->ID);
17 }
18
19 public function userLoggedOut($user_id)
20 {
21 return (new Logtivity_Logger($user_id))
22 ->async(false)
23 ->setAction('User Logged Out')
24 ->send();
25 }
26
27 public function userCreated($user_id)
28 {
29 $user = new Logtivity_WP_User($user_id);
30
31 return Logtivity_Logger::log('User Created. [Role: ' . $user->getRole() . ']', [
32 'key' => 'Username',
33 'value' => $user->userLogin()
34 ]);
35 }
36
37 public function userDeleted($user_id)
38 {
39 $user = new Logtivity_WP_User($user_id);
40
41 return Logtivity_Logger::log('User Deleted. [Role: ' . $user->getRole() . ']', [
42 'key' => 'Username',
43 'value' => $user->userLogin()
44 ]);
45 }
46
47 public function profileUpdated($user_id, $old_user_data)
48 {
49 $user = new Logtivity_WP_User($user_id);
50
51 return Logtivity_Logger::log('Profile Updated. [Role: ' . $user->getRole() . ']', [
52 'key' => 'Username',
53 'value' => $user->userLogin()
54 ]);
55 }
56 }
57
58 $Logtivity_User = new Logtivity_User;