Activity Log - Version 2.8.0

Version Description

  • 2021-11-17 =
  • New: Added Privacy Settings to records log
  • New: Added Site Language to records log
  • New: Added a filter link to Topic, IP, Date, User and Action in the log table screen
  • Tweak: Aligned Topics to be in plural instead of singular
  • Fix: Filter by users dropdown on activity page threw a timeout error in some cases (#141)
  • Fix: CSV Export issue with comma separated values (Topic)
Download this release

Release Info

Developer KingYes
Plugin Icon 128x128 Activity Log
Version 2.8.0
Comparing to
See all releases

Code changes from version 2.7.0 to 2.8.0

aryo-activity-log.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://activitylog.io/?utm_source=wp-plugins&utm_campaign=plugin-ur
5
  Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
  Author: Activity Log Team
7
  Author URI: https://activitylog.io/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
8
- Version: 2.7.0
9
  Text Domain: aryo-activity-log
10
  License: GPLv2 or later
11
 
5
  Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
  Author: Activity Log Team
7
  Author URI: https://activitylog.io/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
8
+ Version: 2.8.0
9
  Text Domain: aryo-activity-log
10
  License: GPLv2 or later
11
 
assets/css/settings.css CHANGED
@@ -1,10 +1,9 @@
1
- body.activity-log_page_activity-log-settings #wpbody h2.aal-page-title::before,
2
- body.toplevel_page_activity_log_page #wpbody h2.aal-page-title::before {
3
  content: "\f321";
4
  font: 400 25px/1 dashicons !important;
5
  speak: none; /* accessibility thing. do not read the contents of this icon */
6
  color: #030303;
7
  display: inline-block;
8
- padding-right: .2em;
9
  vertical-align: -18%;
10
  }
1
+ body h1.aal-page-title:before {
 
2
  content: "\f321";
3
  font: 400 25px/1 dashicons !important;
4
  speak: none; /* accessibility thing. do not read the contents of this icon */
5
  color: #030303;
6
  display: inline-block;
7
+ padding-inline-end: .2em;
8
  vertical-align: -18%;
9
  }
assets/images/elementor-logo.png DELETED
Binary file
classes/class-aal-activity-log-list-table.php CHANGED
@@ -6,13 +6,13 @@ if ( ! class_exists( 'WP_List_Table' ) )
6
 
7
 
8
  class AAL_Activity_Log_List_Table extends WP_List_Table {
9
-
10
  protected $_roles = array();
11
-
12
  protected $_caps = array();
13
-
14
  protected $_allow_caps = array();
15
-
16
  protected function _get_allow_caps() {
17
  if ( empty( $this->_allow_caps ) ) {
18
  $user = get_user_by( 'id', get_current_user_id() );
@@ -63,14 +63,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
63
  $where = array();
64
  foreach ( $allow_modules as $type )
65
  $where[] .= '`object_type` = \'' . $type . '\'';
66
-
67
  $where_caps = array();
68
  foreach ( $this->_get_allow_caps() as $cap )
69
  $where_caps[] .= '`user_caps` = \'' . $cap . '\'';
70
 
71
  return 'AND (' . implode( ' OR ', $where ) . ') AND (' . implode( ' OR ', $where_caps ) . ')';
72
  }
73
-
74
  public function get_action_label( $action ) {
75
  return ucwords( str_replace( '_', ' ', __( $action, 'aryo-activity-log' ) ) );
76
  }
@@ -82,18 +82,55 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
82
  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
83
  )
84
  );
85
-
86
  $this->_roles = apply_filters(
87
  'aal_init_roles',
88
  array(
89
  // admin
90
- 'manage_options' => array( 'Core', 'Export', 'Post', 'Taxonomy', 'User', 'Options', 'Attachment', 'Plugin', 'Widget', 'Theme', 'Menu', 'Comments' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  // editor
92
- 'edit_pages' => array( 'Post', 'Taxonomy', 'Attachment', 'Comments' ),
 
 
 
 
 
 
 
 
 
 
93
  )
94
  );
95
 
96
- $default_rules = array( 'administrator', 'editor', 'author', 'guest' );
 
 
 
 
 
97
 
98
  global $wp_roles;
99
 
@@ -106,8 +143,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
106
  'aal_init_caps',
107
  array(
108
  'administrator' => array_unique( array_merge( $default_rules, $all_roles ) ),
109
- 'editor' => array( 'editor', 'author', 'guest' ),
110
- 'author' => array( 'author', 'guest' ),
111
  )
112
  );
113
 
@@ -137,7 +174,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
137
 
138
  return $columns;
139
  }
140
-
141
  public function get_sortable_columns() {
142
  return array(
143
  'ip' => 'hist_ip',
@@ -147,38 +184,45 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
147
 
148
  public function column_default( $item, $column_name ) {
149
  $return = '';
150
-
151
  switch ( $column_name ) {
152
- case 'action' :
153
- $return = $this->get_action_label( $item->action );
154
  break;
155
- case 'date' :
 
156
  $return = sprintf( '<strong>' . __( '%s ago', 'aryo-activity-log' ) . '</strong>', human_time_diff( $item->hist_time, current_time( 'timestamp' ) ) );
157
- $return .= '<br />' . date( 'd/m/Y', $item->hist_time );
 
 
 
158
  $return .= '<br />' . date( 'H:i:s', $item->hist_time );
159
  break;
160
- case 'ip' :
161
- $return = $item->hist_ip;
 
162
  break;
163
- default :
164
- if ( isset( $item->$column_name ) )
 
165
  $return = $item->$column_name;
 
166
  }
167
 
168
  $return = apply_filters( 'aal_table_list_column_default', $return, $item, $column_name );
169
-
170
  return $return;
171
  }
172
-
173
  public function column_author( $item ) {
174
  global $wp_roles;
175
-
176
  if ( ! empty( $item->user_id ) && 0 !== (int) $item->user_id ) {
177
  $user = get_user_by( 'id', $item->user_id );
178
  if ( $user instanceof WP_User && 0 !== $user->ID ) {
179
  return sprintf(
180
  '<a href="%s">%s <span class="aal-author-name">%s</span></a><br /><small>%s</small>',
181
- get_edit_user_link( $user->ID ),
182
  get_avatar( $user->ID, 40 ),
183
  $user->display_name,
184
  isset( $user->roles[0] ) && isset( $wp_roles->role_names[ $user->roles[0] ] ) ? $wp_roles->role_names[ $user->roles[0] ] : __( 'Unknown', 'aryo-activity-log' )
@@ -193,7 +237,12 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
193
 
194
  public function column_type( $item ) {
195
  $return = __( $item->object_type, 'aryo-activity-log' );
196
-
 
 
 
 
 
197
  $return = apply_filters( 'aal_table_list_column_type', $return, $item );
198
  return $return;
199
  }
@@ -208,13 +257,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
208
  $return = apply_filters( 'aal_table_list_column_label', $return, $item );
209
  return $return;
210
  }
211
-
212
  public function column_description( $item ) {
213
  $return = esc_html( $item->object_name );
214
  $actions = [];
215
-
216
  switch ( $item->object_type ) {
217
- case 'Post' :
 
218
  $actions = [
219
  'view' => sprintf( '<a href="%s">%s</a>', get_permalink( $item->object_id ), __( 'View', 'aryo-activity-log' ) ),
220
  'edit' => sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->object_id ), __( 'Edit', 'aryo-activity-log' ) ),
@@ -222,8 +272,9 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
222
 
223
  $return = esc_html( $item->object_name );
224
  break;
225
-
226
- case 'Taxonomy' :
 
227
  if ( ! empty( $item->object_id ) ) {
228
  if ( is_taxonomy_viewable( $item->object_subtype ) ) {
229
  $term_view_link = get_term_link( absint( $item->object_id ), $item->object_subtype );
@@ -241,8 +292,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
241
  $return = esc_html( $item->object_name );
242
  }
243
  break;
244
-
245
- case 'Comments' :
246
  if ( ! empty( $item->object_id ) && $comment = get_comment( $item->object_id ) ) {
247
  $actions['edit'] = sprintf( '<a href="%s">%s</a>', get_edit_comment_link( $item->object_id ), __( 'Edit', 'aryo-activity-log' ) );
248
  }
@@ -250,7 +301,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
250
  $return = esc_html( "{$item->object_name} #{$item->object_id}" );
251
  break;
252
 
253
- case 'User' :
 
254
  $user_edit_link = get_edit_user_link( $item->object_id );
255
  if ( ! empty( $user_edit_link ) ) {
256
  $actions['edit'] = sprintf( '<a href="%s">%s</a>', $user_edit_link, __( 'Edit', 'aryo-activity-log' ) );
@@ -260,8 +312,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
260
  $return = __( 'Username:', 'aryo-activity-log' ) . ' ' . $item->object_name;
261
  }
262
  break;
263
-
264
- case 'Export' :
265
  if ( 'all' === $item->object_name ) {
266
  $return = __( 'All', 'aryo-activity-log' );
267
  } else {
@@ -270,12 +322,12 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
270
  }
271
  break;
272
 
273
- case 'Options' :
274
- case 'Core' :
275
  $return = __( $item->object_name, 'aryo-activity-log' );
276
  break;
277
  }
278
-
279
  $return = apply_filters( 'aal_table_list_column_description', $return, $item );
280
 
281
  if ( ! empty( $actions ) ) {
@@ -289,10 +341,10 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
289
  }
290
  $return .= '</div>';
291
  }
292
-
293
  return $return;
294
  }
295
-
296
  public function display_tablenav( $which ) {
297
  if ( 'top' == $which ) {
298
  $this->search_box( __( 'Search', 'aryo-activity-log' ), 'aal-search' );
@@ -307,7 +359,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
307
  </div>
308
  <?php
309
  }
310
-
311
  public function extra_tablenav_footer() {
312
  /**
313
  * Filter list of record actions
@@ -325,15 +377,15 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
325
  <?php endforeach; ?>
326
  </select>
327
  </div>
328
- <?php else :
329
  $action_title = reset( $actions );
330
  $action_key = key( $actions );
331
  ?>
332
  <input type="hidden" name="aal-record-action" value="<?php echo esc_attr( $action_key ); ?>">
333
  <?php endif; ?>
334
-
335
  <button type="submit" name="aal-record-actions-submit" id="record-actions-submit" class="button button-primary" value="1">
336
- <?php
337
  // Is result filtering enabled?
338
  if ( array_key_exists( 'aal-filter', $_GET ) ) {
339
  echo sprintf( esc_html__( 'Export filtered records as %s', 'aryo-activity-log' ), $action_title );
@@ -342,14 +394,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
342
  }
343
  ?>
344
  </button>
345
-
346
  <?php wp_nonce_field( 'aal_actions_nonce', 'aal_actions_nonce' ); ?>
347
  <?php
348
  }
349
 
350
  public function extra_tablenav( $which ) {
351
  global $wpdb;
352
-
353
  if ( 'bottom' === $which ) {
354
  $this->extra_tablenav_footer();
355
  }
@@ -365,6 +417,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
365
  ' . $this->_get_where_by_role() . '
366
  GROUP BY `user_id`
367
  ORDER BY `user_id`
 
368
  ;'
369
  );
370
 
@@ -414,7 +467,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
414
  }
415
  echo '</select>';
416
  }
417
-
418
  if ( ! isset( $_REQUEST['usershow'] ) )
419
  $_REQUEST['usershow'] = '';
420
 
@@ -454,7 +507,6 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
454
  echo '</select>';
455
  }
456
 
457
-
458
  $actions = $wpdb->get_results(
459
  'SELECT DISTINCT `action` FROM `' . $wpdb->activity_log . '`
460
  WHERE 1 = 1
@@ -469,8 +521,8 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
469
  $_REQUEST['showaction'] = '';
470
 
471
  $output = array();
472
- foreach ( $actions as $type )
473
- $output[] = sprintf( '<option value="%s"%s>%s</option>', $type->action, selected( $_REQUEST['showaction'], $type->action, false ), $this->get_action_label( $type->action ) );
474
 
475
  echo '<select name="showaction" id="hs-filter-showaction">';
476
  printf( '<option value="">%s</option>', __( 'All Actions', 'aryo-activity-log' ) );
@@ -478,12 +530,27 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
478
  echo '</select>';
479
  }
480
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
481
  echo '</div>';
482
  }
483
-
484
  public function prepare_items() {
485
  global $wpdb;
486
-
487
  $items_per_page = $this->get_items_per_page( 'edit_aal_logs_per_page', 20 );
488
  $this->_column_headers = array( $this->get_columns(), get_hidden_columns( $this->screen ), $this->get_sortable_columns() );
489
  $where = ' WHERE 1 = 1';
@@ -494,7 +561,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
494
  if ( ! isset( $_REQUEST['orderby'] ) || ! in_array( $_REQUEST['orderby'], array( 'hist_time', 'hist_ip' ) ) ) {
495
  $_REQUEST['orderby'] = 'hist_time';
496
  }
497
-
498
  if ( ! empty( $_REQUEST['typeshow'] ) ) {
499
  $where .= $wpdb->prepare( ' AND `object_type` = %s', $_REQUEST['typeshow'] );
500
  }
@@ -503,6 +570,10 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
503
  $where .= $wpdb->prepare( ' AND `action` = %s', $_REQUEST['showaction'] );
504
  }
505
 
 
 
 
 
506
  if ( isset( $_REQUEST['usershow'] ) && '' !== $_REQUEST['usershow'] ) {
507
  $where .= $wpdb->prepare( ' AND `user_id` = %d', $_REQUEST['usershow'] );
508
  }
@@ -511,23 +582,34 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
511
  $where .= $wpdb->prepare( ' AND `user_caps` = %s', strtolower( $_REQUEST['capshow'] ) );
512
  }
513
 
514
- if ( isset( $_REQUEST['dateshow'] ) && in_array( $_REQUEST['dateshow'], array( 'today', 'yesterday', 'week', 'month' ) ) ) {
515
  $current_time = current_time( 'timestamp' );
516
 
517
- // Today
518
- $start_time = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );;
519
- $end_time = mktime( 23, 59, 59, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
520
-
521
- if ( 'yesterday' === $_REQUEST['dateshow'] ) {
522
- $start_time = strtotime( 'yesterday', $start_time );
523
- $end_time = mktime( 23, 59, 59, date( 'm', $start_time ), date( 'd', $start_time ), date( 'Y', $start_time ) );
524
- } elseif ( 'week' === $_REQUEST['dateshow'] ) {
525
- $start_time = strtotime( '-1 week', $start_time );
526
- } elseif ( 'month' === $_REQUEST['dateshow'] ) {
527
- $start_time = strtotime( '-1 month', $start_time );
 
 
 
 
 
 
 
 
 
 
 
 
 
528
  }
529
-
530
- $where .= $wpdb->prepare( ' AND `hist_time` > %d AND `hist_time` < %d', $start_time, $end_time );
531
  }
532
 
533
  if ( isset( $_REQUEST['s'] ) ) {
@@ -537,7 +619,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
537
 
538
  $offset = ( $this->get_pagenum() - 1 ) * $items_per_page;
539
 
540
-
541
  $total_items = $wpdb->get_var(
542
  'SELECT COUNT(`histid`) FROM `' . $wpdb->activity_log . '`
543
  ' . $where . '
@@ -570,7 +652,7 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
570
  'total_pages' => ceil( $total_items / $items_per_page ),
571
  ) );
572
  }
573
-
574
  public function set_screen_option( $status, $option, $value ) {
575
  if ( 'edit_aal_logs_per_page' === $option )
576
  return $value;
@@ -589,4 +671,14 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
589
  </p>
590
  <?php
591
  }
 
 
 
 
 
 
 
 
 
 
592
  }
6
 
7
 
8
  class AAL_Activity_Log_List_Table extends WP_List_Table {
9
+
10
  protected $_roles = array();
11
+
12
  protected $_caps = array();
13
+
14
  protected $_allow_caps = array();
15
+
16
  protected function _get_allow_caps() {
17
  if ( empty( $this->_allow_caps ) ) {
18
  $user = get_user_by( 'id', get_current_user_id() );
63
  $where = array();
64
  foreach ( $allow_modules as $type )
65
  $where[] .= '`object_type` = \'' . $type . '\'';
66
+
67
  $where_caps = array();
68
  foreach ( $this->_get_allow_caps() as $cap )
69
  $where_caps[] .= '`user_caps` = \'' . $cap . '\'';
70
 
71
  return 'AND (' . implode( ' OR ', $where ) . ') AND (' . implode( ' OR ', $where_caps ) . ')';
72
  }
73
+
74
  public function get_action_label( $action ) {
75
  return ucwords( str_replace( '_', ' ', __( $action, 'aryo-activity-log' ) ) );
76
  }
82
  'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
83
  )
84
  );
85
+
86
  $this->_roles = apply_filters(
87
  'aal_init_roles',
88
  array(
89
  // admin
90
+ 'manage_options' => array(
91
+ 'Core',
92
+ 'Export',
93
+ 'Posts',
94
+ 'Taxonomies',
95
+ 'Users',
96
+ 'Options',
97
+ 'Attachments',
98
+ 'Plugins',
99
+ 'Widgets',
100
+ 'Themes',
101
+ 'Menus',
102
+ 'Comments',
103
+
104
+ // BC
105
+ 'Post',
106
+ 'Taxonomy',
107
+ 'User',
108
+ 'Plugin',
109
+ 'Widget',
110
+ 'Theme',
111
+ 'Menu',
112
+ ),
113
  // editor
114
+ 'edit_pages' => array(
115
+ 'Posts',
116
+ 'Taxonomies',
117
+ 'Attachments',
118
+ 'Comments',
119
+
120
+ // BC
121
+ 'Post',
122
+ 'Taxonomy',
123
+ 'Attachment',
124
+ ),
125
  )
126
  );
127
 
128
+ $default_rules = array(
129
+ 'administrator',
130
+ 'editor',
131
+ 'author',
132
+ 'guest',
133
+ );
134
 
135
  global $wp_roles;
136
 
143
  'aal_init_caps',
144
  array(
145
  'administrator' => array_unique( array_merge( $default_rules, $all_roles ) ),
146
+ 'editor' => array( 'editor', 'author', 'guest' ),
147
+ 'author' => array( 'author', 'guest' ),
148
  )
149
  );
150
 
174
 
175
  return $columns;
176
  }
177
+
178
  public function get_sortable_columns() {
179
  return array(
180
  'ip' => 'hist_ip',
184
 
185
  public function column_default( $item, $column_name ) {
186
  $return = '';
187
+
188
  switch ( $column_name ) {
189
+ case 'action':
190
+ $return = '<a href="' . $this->get_filtered_link( 'showaction', $item->action ) . '">' . $this->get_action_label( $item->action ) . '</a>';
191
  break;
192
+
193
+ case 'date':
194
  $return = sprintf( '<strong>' . __( '%s ago', 'aryo-activity-log' ) . '</strong>', human_time_diff( $item->hist_time, current_time( 'timestamp' ) ) );
195
+
196
+ $date_formatted = date( 'd/m/Y', $item->hist_time );
197
+ $return .= '<br /><a href="' . $this->get_filtered_link( 'dateshow', $date_formatted ) . '">' . date( 'd/m/Y', $item->hist_time ) . '</a>';
198
+
199
  $return .= '<br />' . date( 'H:i:s', $item->hist_time );
200
  break;
201
+
202
+ case 'ip':
203
+ $return = '<a href="' . $this->get_filtered_link( 'filter_ip', $item->hist_ip ) . '">' . $item->hist_ip. '</a>';
204
  break;
205
+
206
+ default:
207
+ if ( isset( $item->$column_name ) ) {
208
  $return = $item->$column_name;
209
+ }
210
  }
211
 
212
  $return = apply_filters( 'aal_table_list_column_default', $return, $item, $column_name );
213
+
214
  return $return;
215
  }
216
+
217
  public function column_author( $item ) {
218
  global $wp_roles;
219
+
220
  if ( ! empty( $item->user_id ) && 0 !== (int) $item->user_id ) {
221
  $user = get_user_by( 'id', $item->user_id );
222
  if ( $user instanceof WP_User && 0 !== $user->ID ) {
223
  return sprintf(
224
  '<a href="%s">%s <span class="aal-author-name">%s</span></a><br /><small>%s</small>',
225
+ $this->get_filtered_link( 'usershow', $user->ID ),
226
  get_avatar( $user->ID, 40 ),
227
  $user->display_name,
228
  isset( $user->roles[0] ) && isset( $wp_roles->role_names[ $user->roles[0] ] ) ? $wp_roles->role_names[ $user->roles[0] ] : __( 'Unknown', 'aryo-activity-log' )
237
 
238
  public function column_type( $item ) {
239
  $return = __( $item->object_type, 'aryo-activity-log' );
240
+
241
+ if ( ! empty( $item->object_type ) ) {
242
+ $link = $this->get_filtered_link( 'typeshow', $item->object_type );
243
+ $return = "<a href=\"{$link}\">{$return}</a>";
244
+ }
245
+
246
  $return = apply_filters( 'aal_table_list_column_type', $return, $item );
247
  return $return;
248
  }
257
  $return = apply_filters( 'aal_table_list_column_label', $return, $item );
258
  return $return;
259
  }
260
+
261
  public function column_description( $item ) {
262
  $return = esc_html( $item->object_name );
263
  $actions = [];
264
+
265
  switch ( $item->object_type ) {
266
+ case 'Post':
267
+ case 'Posts':
268
  $actions = [
269
  'view' => sprintf( '<a href="%s">%s</a>', get_permalink( $item->object_id ), __( 'View', 'aryo-activity-log' ) ),
270
  'edit' => sprintf( '<a href="%s">%s</a>', get_edit_post_link( $item->object_id ), __( 'Edit', 'aryo-activity-log' ) ),
272
 
273
  $return = esc_html( $item->object_name );
274
  break;
275
+
276
+ case 'Taxonomy':
277
+ case 'Taxonomies':
278
  if ( ! empty( $item->object_id ) ) {
279
  if ( is_taxonomy_viewable( $item->object_subtype ) ) {
280
  $term_view_link = get_term_link( absint( $item->object_id ), $item->object_subtype );
292
  $return = esc_html( $item->object_name );
293
  }
294
  break;
295
+
296
+ case 'Comments':
297
  if ( ! empty( $item->object_id ) && $comment = get_comment( $item->object_id ) ) {
298
  $actions['edit'] = sprintf( '<a href="%s">%s</a>', get_edit_comment_link( $item->object_id ), __( 'Edit', 'aryo-activity-log' ) );
299
  }
301
  $return = esc_html( "{$item->object_name} #{$item->object_id}" );
302
  break;
303
 
304
+ case 'User':
305
+ case 'Users':
306
  $user_edit_link = get_edit_user_link( $item->object_id );
307
  if ( ! empty( $user_edit_link ) ) {
308
  $actions['edit'] = sprintf( '<a href="%s">%s</a>', $user_edit_link, __( 'Edit', 'aryo-activity-log' ) );
312
  $return = __( 'Username:', 'aryo-activity-log' ) . ' ' . $item->object_name;
313
  }
314
  break;
315
+
316
+ case 'Export':
317
  if ( 'all' === $item->object_name ) {
318
  $return = __( 'All', 'aryo-activity-log' );
319
  } else {
322
  }
323
  break;
324
 
325
+ case 'Options':
326
+ case 'Core':
327
  $return = __( $item->object_name, 'aryo-activity-log' );
328
  break;
329
  }
330
+
331
  $return = apply_filters( 'aal_table_list_column_description', $return, $item );
332
 
333
  if ( ! empty( $actions ) ) {
341
  }
342
  $return .= '</div>';
343
  }
344
+
345
  return $return;
346
  }
347
+
348
  public function display_tablenav( $which ) {
349
  if ( 'top' == $which ) {
350
  $this->search_box( __( 'Search', 'aryo-activity-log' ), 'aal-search' );
359
  </div>
360
  <?php
361
  }
362
+
363
  public function extra_tablenav_footer() {
364
  /**
365
  * Filter list of record actions
377
  <?php endforeach; ?>
378
  </select>
379
  </div>
380
+ <?php else :
381
  $action_title = reset( $actions );
382
  $action_key = key( $actions );
383
  ?>
384
  <input type="hidden" name="aal-record-action" value="<?php echo esc_attr( $action_key ); ?>">
385
  <?php endif; ?>
386
+
387
  <button type="submit" name="aal-record-actions-submit" id="record-actions-submit" class="button button-primary" value="1">
388
+ <?php
389
  // Is result filtering enabled?
390
  if ( array_key_exists( 'aal-filter', $_GET ) ) {
391
  echo sprintf( esc_html__( 'Export filtered records as %s', 'aryo-activity-log' ), $action_title );
394
  }
395
  ?>
396
  </button>
397
+
398
  <?php wp_nonce_field( 'aal_actions_nonce', 'aal_actions_nonce' ); ?>
399
  <?php
400
  }
401
 
402
  public function extra_tablenav( $which ) {
403
  global $wpdb;
404
+
405
  if ( 'bottom' === $which ) {
406
  $this->extra_tablenav_footer();
407
  }
417
  ' . $this->_get_where_by_role() . '
418
  GROUP BY `user_id`
419
  ORDER BY `user_id`
420
+ LIMIT 100
421
  ;'
422
  );
423
 
467
  }
468
  echo '</select>';
469
  }
470
+
471
  if ( ! isset( $_REQUEST['usershow'] ) )
472
  $_REQUEST['usershow'] = '';
473
 
507
  echo '</select>';
508
  }
509
 
 
510
  $actions = $wpdb->get_results(
511
  'SELECT DISTINCT `action` FROM `' . $wpdb->activity_log . '`
512
  WHERE 1 = 1
521
  $_REQUEST['showaction'] = '';
522
 
523
  $output = array();
524
+ foreach ( $actions as $action )
525
+ $output[] = sprintf( '<option value="%s"%s>%s</option>', $action->action, selected( $_REQUEST['showaction'], $action->action, false ), $this->get_action_label( $action->action ) );
526
 
527
  echo '<select name="showaction" id="hs-filter-showaction">';
528
  printf( '<option value="">%s</option>', __( 'All Actions', 'aryo-activity-log' ) );
530
  echo '</select>';
531
  }
532
 
533
+ $filters = array(
534
+ 'dateshow',
535
+ 'capshow',
536
+ 'usershow',
537
+ 'typeshow',
538
+ 'showaction',
539
+ );
540
+
541
+ foreach ( $filters as $filter ) {
542
+ if ( ! empty( $_REQUEST[ $filter ] ) ) {
543
+ echo '<a href="' . $this->get_filtered_link() . '" id="aal-reset-filter"><span class="dashicons dashicons-dismiss"></span>' . __( 'Reset Filters', 'aryo-activity-log' ) . '</a>';
544
+ break;
545
+ }
546
+ }
547
+
548
  echo '</div>';
549
  }
550
+
551
  public function prepare_items() {
552
  global $wpdb;
553
+
554
  $items_per_page = $this->get_items_per_page( 'edit_aal_logs_per_page', 20 );
555
  $this->_column_headers = array( $this->get_columns(), get_hidden_columns( $this->screen ), $this->get_sortable_columns() );
556
  $where = ' WHERE 1 = 1';
561
  if ( ! isset( $_REQUEST['orderby'] ) || ! in_array( $_REQUEST['orderby'], array( 'hist_time', 'hist_ip' ) ) ) {
562
  $_REQUEST['orderby'] = 'hist_time';
563
  }
564
+
565
  if ( ! empty( $_REQUEST['typeshow'] ) ) {
566
  $where .= $wpdb->prepare( ' AND `object_type` = %s', $_REQUEST['typeshow'] );
567
  }
570
  $where .= $wpdb->prepare( ' AND `action` = %s', $_REQUEST['showaction'] );
571
  }
572
 
573
+ if ( isset( $_REQUEST['filter_ip'] ) && '' !== $_REQUEST['filter_ip'] ) {
574
+ $where .= $wpdb->prepare( ' AND `hist_ip` = %s', $_REQUEST['filter_ip'] );
575
+ }
576
+
577
  if ( isset( $_REQUEST['usershow'] ) && '' !== $_REQUEST['usershow'] ) {
578
  $where .= $wpdb->prepare( ' AND `user_id` = %d', $_REQUEST['usershow'] );
579
  }
582
  $where .= $wpdb->prepare( ' AND `user_caps` = %s', strtolower( $_REQUEST['capshow'] ) );
583
  }
584
 
585
+ if ( isset( $_REQUEST['dateshow'] ) ) {
586
  $current_time = current_time( 'timestamp' );
587
 
588
+ if ( in_array( $_REQUEST['dateshow'], array( 'today', 'yesterday', 'week', 'month' ) ) ) {
589
+ // Today
590
+ $start_time = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
591
+ $end_time = mktime( 23, 59, 59, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
592
+
593
+ if ( 'yesterday' === $_REQUEST['dateshow'] ) {
594
+ $start_time = strtotime( 'yesterday', $start_time );
595
+ $end_time = mktime( 23, 59, 59, date( 'm', $start_time ), date( 'd', $start_time ), date( 'Y', $start_time ) );
596
+ } elseif ( 'week' === $_REQUEST['dateshow'] ) {
597
+ $start_time = strtotime( '-1 week', $start_time );
598
+ } elseif ( 'month' === $_REQUEST['dateshow'] ) {
599
+ $start_time = strtotime( '-1 month', $start_time );
600
+ }
601
+ } else {
602
+ $date_array = explode( '/', $_REQUEST['dateshow'] );
603
+
604
+ if ( 3 === count( $date_array ) ) {
605
+ $start_time = mktime( 0, 0, 0, (int) $date_array[1], (int) $date_array[0], (int) $date_array[2] );
606
+ $end_time = mktime( 23, 59, 59, (int) $date_array[1], (int) $date_array[0], (int) $date_array[2] );
607
+ }
608
+ }
609
+
610
+ if ( ! empty( $start_time ) && ! empty( $end_time ) ) {
611
+ $where .= $wpdb->prepare( ' AND `hist_time` > %d AND `hist_time` < %d', $start_time, $end_time );
612
  }
 
 
613
  }
614
 
615
  if ( isset( $_REQUEST['s'] ) ) {
619
 
620
  $offset = ( $this->get_pagenum() - 1 ) * $items_per_page;
621
 
622
+
623
  $total_items = $wpdb->get_var(
624
  'SELECT COUNT(`histid`) FROM `' . $wpdb->activity_log . '`
625
  ' . $where . '
652
  'total_pages' => ceil( $total_items / $items_per_page ),
653
  ) );
654
  }
655
+
656
  public function set_screen_option( $status, $option, $value ) {
657
  if ( 'edit_aal_logs_per_page' === $option )
658
  return $value;
671
  </p>
672
  <?php
673
  }
674
+
675
+ private function get_filtered_link( $name = '', $value = '' ) {
676
+ $base_page_url = menu_page_url( 'activity_log_page', false );
677
+
678
+ if ( empty( $name ) ) {
679
+ return $base_page_url;
680
+ }
681
+
682
+ return add_query_arg( $name, $value, $base_page_url );
683
+ }
684
  }
classes/class-aal-admin-ui.php CHANGED
@@ -54,6 +54,26 @@ class AAL_Admin_Ui {
54
  #adminmenu #toplevel_page_activity_log_page div.wp-menu-image:before {
55
  content: "\f321";
56
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  @media (max-width: 767px) {
58
  .toplevel_page_activity_log_page .manage-column {
59
  width: auto;
@@ -107,6 +127,26 @@ class AAL_Admin_Ui {
107
  $install_url = self_admin_url( 'plugin-install.php?tab=search&s=elementor' );
108
  ?>
109
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  .notice.aal-notice {
111
  border-left-color: #92003B !important;
112
  padding: 20px;
54
  #adminmenu #toplevel_page_activity_log_page div.wp-menu-image:before {
55
  content: "\f321";
56
  }
57
+ h1.aal-page-title:before {
58
+ content: "\f321";
59
+ font: 400 25px/1 dashicons !important;
60
+ speak: none; /* accessibility thing. do not read the contents of this icon */
61
+ color: #030303;
62
+ display: inline-block;
63
+ padding-inline-end: .2em;
64
+ vertical-align: -18%;
65
+ }
66
+ #aal-reset-filter {
67
+ display: inline-block;
68
+ margin-inline-start: 5px;
69
+ line-height: 30px;
70
+ text-decoration: none;
71
+ }
72
+ #aal-reset-filter .dashicons {
73
+ font-size: 15px;
74
+ line-height: 30px;
75
+ text-decoration: none;
76
+ }
77
  @media (max-width: 767px) {
78
  .toplevel_page_activity_log_page .manage-column {
79
  width: auto;
127
  $install_url = self_admin_url( 'plugin-install.php?tab=search&s=elementor' );
128
  ?>
129
  <style>
130
+ body h1.aal-page-title:before {
131
+ content: "\f321";
132
+ font: 400 25px/1 dashicons !important;
133
+ speak: none; /* accessibility thing. do not read the contents of this icon */
134
+ color: #030303;
135
+ display: inline-block;
136
+ padding-inline-end: .2em;
137
+ vertical-align: -18%;
138
+ }
139
+ #aal-reset-filter {
140
+ display: inline-block;
141
+ margin-inline-start: 5px;
142
+ line-height: 30px;
143
+ text-decoration: none;
144
+ }
145
+ #aal-reset-filter .dashicons {
146
+ font-size: 15px;
147
+ line-height: 30px;
148
+ text-decoration: none;
149
+ }
150
  .notice.aal-notice {
151
  border-left-color: #92003B !important;
152
  padding: 20px;
classes/class-aal-hooks.php CHANGED
@@ -9,27 +9,27 @@ class AAL_Hooks {
9
 
10
  // TODO: Maybe I will use with glob() function for this.
11
  // Load all our hooks.
12
- include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-user.php' );
13
- include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-attachment.php' );
14
- include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-menu.php' );
15
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-options.php' );
16
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-plugins.php' );
17
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-posts.php' );
18
- include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-taxonomy.php' );
19
- include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-theme.php' );
20
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-widgets.php' );
21
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-core.php' );
22
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-export.php' );
23
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-comments.php' );
24
 
25
- new AAL_Hook_User();
26
- new AAL_Hook_Attachment();
27
- new AAL_Hook_Menu();
28
  new AAL_Hook_Options();
29
  new AAL_Hook_Plugins();
30
  new AAL_Hook_Posts();
31
- new AAL_Hook_Taxonomy();
32
- new AAL_Hook_Theme();
33
  new AAL_Hook_Widgets();
34
  new AAL_Hook_Core();
35
  new AAL_Hook_Export();
9
 
10
  // TODO: Maybe I will use with glob() function for this.
11
  // Load all our hooks.
12
+ include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-users.php' );
13
+ include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-attachments.php' );
14
+ include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-menus.php' );
15
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-options.php' );
16
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-plugins.php' );
17
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-posts.php' );
18
+ include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-taxonomies.php' );
19
+ include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-themes.php' );
20
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-widgets.php' );
21
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-core.php' );
22
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-export.php' );
23
  include( plugin_dir_path( ACTIVITY_LOG__FILE__ ) . '/hooks/class-aal-hook-comments.php' );
24
 
25
+ new AAL_Hook_Users();
26
+ new AAL_Hook_Attachments();
27
+ new AAL_Hook_Menus();
28
  new AAL_Hook_Options();
29
  new AAL_Hook_Plugins();
30
  new AAL_Hook_Posts();
31
+ new AAL_Hook_Taxonomies();
32
+ new AAL_Hook_Themes();
33
  new AAL_Hook_Widgets();
34
  new AAL_Hook_Core();
35
  new AAL_Hook_Export();
classes/class-aal-notifications.php CHANGED
@@ -65,16 +65,25 @@ class AAL_Notifications {
65
  array(
66
  'Core',
67
  'Export',
 
 
 
 
 
 
 
 
 
 
 
 
68
  'Post',
69
  'Taxonomy',
70
  'User',
71
- 'Options',
72
- 'Attachment',
73
  'Plugin',
74
  'Widget',
75
  'Theme',
76
  'Menu',
77
- 'Comments',
78
  )
79
  );
80
 
65
  array(
66
  'Core',
67
  'Export',
68
+ 'Posts',
69
+ 'Taxonomies',
70
+ 'Users',
71
+ 'Options',
72
+ 'Attachments',
73
+ 'Plugins',
74
+ 'Widgets',
75
+ 'Themes',
76
+ 'Menus',
77
+ 'Comments',
78
+
79
+ // BC
80
  'Post',
81
  'Taxonomy',
82
  'User',
 
 
83
  'Plugin',
84
  'Widget',
85
  'Theme',
86
  'Menu',
 
87
  )
88
  );
89
 
exporters/class-aal-exporter-csv.php CHANGED
@@ -25,18 +25,21 @@ class AAL_Exporter_csv {
25
  */
26
  public function write( $data, $columns ) {
27
  $is_test_mode_off = ! defined( 'AAL_TESTMODE' ) || ( defined( 'AAL_TESTMODE' ) && ! AAL_TESTMODE );
28
-
29
  if ( $is_test_mode_off ) {
30
  header( 'Content-type: text/csv' );
31
  header( 'Content-Disposition: attachment; filename="activity-log-export.csv"' );
32
  }
33
 
34
- $output = join( ',', array_values( $columns ) ) . "\n";
 
 
 
35
  foreach ( $data as $row ) {
36
- $output .= join( ',', $row ) . "\n";
37
  }
38
 
39
- echo $output; // @codingStandardsIgnoreLine text-only output
40
 
41
  if ( $is_test_mode_off ) {
42
  exit;
25
  */
26
  public function write( $data, $columns ) {
27
  $is_test_mode_off = ! defined( 'AAL_TESTMODE' ) || ( defined( 'AAL_TESTMODE' ) && ! AAL_TESTMODE );
28
+
29
  if ( $is_test_mode_off ) {
30
  header( 'Content-type: text/csv' );
31
  header( 'Content-Disposition: attachment; filename="activity-log-export.csv"' );
32
  }
33
 
34
+ $fp = fopen( 'php://output', 'w' );
35
+
36
+ fputcsv( $fp, $columns );
37
+
38
  foreach ( $data as $row ) {
39
+ fputcsv( $fp, $row );
40
  }
41
 
42
+ fclose( $fp );
43
 
44
  if ( $is_test_mode_off ) {
45
  exit;
hooks/{class-aal-hook-attachment.php → class-aal-hook-attachments.php} RENAMED
@@ -1,14 +1,14 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
- class AAL_Hook_Attachment extends AAL_Hook_Base {
5
 
6
  protected function _add_log_attachment( $action, $attachment_id ) {
7
  $post = get_post( $attachment_id );
8
 
9
  aal_insert_log( array(
10
  'action' => $action,
11
- 'object_type' => 'Attachment',
12
  'object_subtype' => $post->post_type,
13
  'object_id' => $attachment_id,
14
  'object_name' => esc_html( get_the_title( $post->ID ) ),
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ class AAL_Hook_Attachments extends AAL_Hook_Base {
5
 
6
  protected function _add_log_attachment( $action, $attachment_id ) {
7
  $post = get_post( $attachment_id );
8
 
9
  aal_insert_log( array(
10
  'action' => $action,
11
+ 'object_type' => 'Attachments',
12
  'object_subtype' => $post->post_type,
13
  'object_id' => $attachment_id,
14
  'object_name' => esc_html( get_the_title( $post->ID ) ),
hooks/{class-aal-hook-menu.php → class-aal-hook-menus.php} RENAMED
@@ -1,7 +1,7 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
- class AAL_Hook_Menu extends AAL_Hook_Base {
5
 
6
  public function hooks_menu_created_or_updated( $nav_menu_selected_id ) {
7
  if ( $menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ) ) {
@@ -13,7 +13,7 @@ class AAL_Hook_Menu extends AAL_Hook_Base {
13
 
14
  aal_insert_log( array(
15
  'action' => $action,
16
- 'object_type' => 'Menu',
17
  'object_name' => $menu_object->name,
18
  ) );
19
  }
@@ -22,7 +22,7 @@ class AAL_Hook_Menu extends AAL_Hook_Base {
22
  public function hooks_menu_deleted( $term, $tt_id, $deleted_term ) {
23
  aal_insert_log( array(
24
  'action' => 'deleted',
25
- 'object_type' => 'Menu',
26
  'object_name' => $deleted_term->name,
27
  ) );
28
  }
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ class AAL_Hook_Menus extends AAL_Hook_Base {
5
 
6
  public function hooks_menu_created_or_updated( $nav_menu_selected_id ) {
7
  if ( $menu_object = wp_get_nav_menu_object( $nav_menu_selected_id ) ) {
13
 
14
  aal_insert_log( array(
15
  'action' => $action,
16
+ 'object_type' => 'Menus',
17
  'object_name' => $menu_object->name,
18
  ) );
19
  }
22
  public function hooks_menu_deleted( $term, $tt_id, $deleted_term ) {
23
  aal_insert_log( array(
24
  'action' => 'deleted',
25
+ 'object_type' => 'Menus',
26
  'object_name' => $deleted_term->name,
27
  ) );
28
  }
hooks/class-aal-hook-options.php CHANGED
@@ -13,6 +13,7 @@ class AAL_Hook_Options extends AAL_Hook_Base {
13
  'admin_email',
14
  'users_can_register',
15
  'default_role',
 
16
  'timezone_string',
17
  'date_format',
18
  'time_format',
@@ -78,6 +79,9 @@ class AAL_Hook_Options extends AAL_Hook_Base {
78
  'category_base',
79
  'tag_base',
80
 
 
 
 
81
  // Widgets
82
  'sidebars_widgets',
83
  ) );
13
  'admin_email',
14
  'users_can_register',
15
  'default_role',
16
+ 'WPLANG',
17
  'timezone_string',
18
  'date_format',
19
  'time_format',
79
  'category_base',
80
  'tag_base',
81
 
82
+ // Privacy
83
+ 'wp_page_for_privacy_policy',
84
+
85
  // Widgets
86
  'sidebars_widgets',
87
  ) );
hooks/class-aal-hook-plugins.php CHANGED
@@ -15,7 +15,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
15
  aal_insert_log(
16
  array(
17
  'action' => $action,
18
- 'object_type' => 'Plugin',
19
  'object_id' => 0,
20
  'object_name' => $plugin_name,
21
  )
@@ -35,7 +35,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
35
  if ( ( ! empty( $_POST ) && 'update' === $_REQUEST['action'] ) ) {
36
  $aal_args = array(
37
  'action' => 'file_updated',
38
- 'object_type' => 'Plugin',
39
  'object_subtype' => 'plugin_unknown',
40
  'object_id' => 0,
41
  'object_name' => 'file_unknown',
@@ -76,7 +76,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
76
  aal_insert_log(
77
  array(
78
  'action' => 'installed',
79
- 'object_type' => 'Plugin',
80
  'object_name' => $data['Name'],
81
  'object_subtype' => $data['Version'],
82
  )
@@ -99,7 +99,7 @@ class AAL_Hook_Plugins extends AAL_Hook_Base {
99
  aal_insert_log(
100
  array(
101
  'action' => 'updated',
102
- 'object_type' => 'Plugin',
103
  'object_name' => $data['Name'],
104
  'object_subtype' => $data['Version'],
105
  )
15
  aal_insert_log(
16
  array(
17
  'action' => $action,
18
+ 'object_type' => 'Plugins',
19
  'object_id' => 0,
20
  'object_name' => $plugin_name,
21
  )
35
  if ( ( ! empty( $_POST ) && 'update' === $_REQUEST['action'] ) ) {
36
  $aal_args = array(
37
  'action' => 'file_updated',
38
+ 'object_type' => 'Plugins',
39
  'object_subtype' => 'plugin_unknown',
40
  'object_id' => 0,
41
  'object_name' => 'file_unknown',
76
  aal_insert_log(
77
  array(
78
  'action' => 'installed',
79
+ 'object_type' => 'Plugins',
80
  'object_name' => $data['Name'],
81
  'object_subtype' => $data['Version'],
82
  )
99
  aal_insert_log(
100
  array(
101
  'action' => 'updated',
102
+ 'object_type' => 'Plugins',
103
  'object_name' => $data['Name'],
104
  'object_subtype' => $data['Version'],
105
  )
hooks/class-aal-hook-posts.php CHANGED
@@ -16,19 +16,15 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
16
  if ( 'auto-draft' === $old_status && ( 'auto-draft' !== $new_status && 'inherit' !== $new_status ) ) {
17
  // page created
18
  $action = 'created';
19
- }
20
- elseif ( 'auto-draft' === $new_status || ( 'new' === $old_status && 'inherit' === $new_status ) ) {
21
  // nvm.. ignore it.
22
  return;
23
- }
24
- elseif ( 'trash' === $new_status ) {
25
  // page was deleted.
26
  $action = 'trashed';
27
- }
28
- elseif ( 'trash' === $old_status ) {
29
  $action = 'restored';
30
- }
31
- else {
32
  // page updated. I guess.
33
  $action = 'updated';
34
  }
@@ -43,7 +39,7 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
43
  aal_insert_log(
44
  array(
45
  'action' => $action,
46
- 'object_type' => 'Post',
47
  'object_subtype' => $post->post_type,
48
  'object_id' => $post->ID,
49
  'object_name' => $this->_draft_or_post_title( $post->ID ),
@@ -71,7 +67,7 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
71
  aal_insert_log(
72
  array(
73
  'action' => 'deleted',
74
- 'object_type' => 'Post',
75
  'object_subtype' => $post->post_type,
76
  'object_id' => $post->ID,
77
  'object_name' => $this->_draft_or_post_title( $post->ID ),
16
  if ( 'auto-draft' === $old_status && ( 'auto-draft' !== $new_status && 'inherit' !== $new_status ) ) {
17
  // page created
18
  $action = 'created';
19
+ } elseif ( 'auto-draft' === $new_status || ( 'new' === $old_status && 'inherit' === $new_status ) ) {
 
20
  // nvm.. ignore it.
21
  return;
22
+ } elseif ( 'trash' === $new_status ) {
 
23
  // page was deleted.
24
  $action = 'trashed';
25
+ } elseif ( 'trash' === $old_status ) {
 
26
  $action = 'restored';
27
+ } else {
 
28
  // page updated. I guess.
29
  $action = 'updated';
30
  }
39
  aal_insert_log(
40
  array(
41
  'action' => $action,
42
+ 'object_type' => 'Posts',
43
  'object_subtype' => $post->post_type,
44
  'object_id' => $post->ID,
45
  'object_name' => $this->_draft_or_post_title( $post->ID ),
67
  aal_insert_log(
68
  array(
69
  'action' => 'deleted',
70
+ 'object_type' => 'Posts',
71
  'object_subtype' => $post->post_type,
72
  'object_id' => $post->ID,
73
  'object_name' => $this->_draft_or_post_title( $post->ID ),
hooks/{class-aal-hook-taxonomy.php → class-aal-hook-taxonomies.php} RENAMED
@@ -1,7 +1,7 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
- class AAL_Hook_Taxonomy extends AAL_Hook_Base {
5
 
6
  public function hooks_created_edited_deleted_term( $term_id, $tt_id, $taxonomy, $deleted_term = null ) {
7
  // Make sure do not action nav menu taxonomy.
@@ -25,7 +25,7 @@ class AAL_Hook_Taxonomy extends AAL_Hook_Base {
25
 
26
  aal_insert_log( array(
27
  'action' => $action,
28
- 'object_type' => 'Taxonomy',
29
  'object_subtype' => $taxonomy,
30
  'object_id' => $term_id,
31
  'object_name' => $term->name,
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ class AAL_Hook_Taxonomies extends AAL_Hook_Base {
5
 
6
  public function hooks_created_edited_deleted_term( $term_id, $tt_id, $taxonomy, $deleted_term = null ) {
7
  // Make sure do not action nav menu taxonomy.
25
 
26
  aal_insert_log( array(
27
  'action' => $action,
28
+ 'object_type' => 'Taxonomies',
29
  'object_subtype' => $taxonomy,
30
  'object_id' => $term_id,
31
  'object_name' => $term->name,
hooks/{class-aal-hook-theme.php → class-aal-hook-themes.php} RENAMED
@@ -1,14 +1,14 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
- class AAL_Hook_Theme extends AAL_Hook_Base {
5
 
6
  public function hooks_theme_modify( $location, $status ) {
7
  if ( false !== strpos( $location, 'theme-editor.php?file=' ) ) {
8
  if ( ! empty( $_POST ) && 'update' === $_POST['action'] ) {
9
  $aal_args = array(
10
  'action' => 'file_updated',
11
- 'object_type' => 'Theme',
12
  'object_subtype' => 'theme_unknown',
13
  'object_id' => 0,
14
  'object_name' => 'file_unknown',
@@ -32,7 +32,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
32
  aal_insert_log(
33
  array(
34
  'action' => 'activated',
35
- 'object_type' => 'Theme',
36
  'object_subtype' => $new_theme->get_stylesheet(),
37
  'object_id' => 0,
38
  'object_name' => $new_name,
@@ -43,7 +43,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
43
  public function hooks_theme_customizer_modified( WP_Customize_Manager $obj ) {
44
  $aal_args = array(
45
  'action' => 'updated',
46
- 'object_type' => 'Theme',
47
  'object_subtype' => $obj->theme()->display( 'Name' ),
48
  'object_id' => 0,
49
  'object_name' => 'Theme Customizer',
@@ -74,7 +74,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
74
  aal_insert_log(
75
  array(
76
  'action' => 'deleted',
77
- 'object_type' => 'Theme',
78
  'object_name' => $name,
79
  )
80
  );
@@ -101,7 +101,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
101
  aal_insert_log(
102
  array(
103
  'action' => 'installed',
104
- 'object_type' => 'Theme',
105
  'object_name' => $name,
106
  'object_subtype' => $version,
107
  )
@@ -125,7 +125,7 @@ class AAL_Hook_Theme extends AAL_Hook_Base {
125
  aal_insert_log(
126
  array(
127
  'action' => 'updated',
128
- 'object_type' => 'Theme',
129
  'object_name' => $name,
130
  'object_subtype' => $version,
131
  )
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ class AAL_Hook_Themes extends AAL_Hook_Base {
5
 
6
  public function hooks_theme_modify( $location, $status ) {
7
  if ( false !== strpos( $location, 'theme-editor.php?file=' ) ) {
8
  if ( ! empty( $_POST ) && 'update' === $_POST['action'] ) {
9
  $aal_args = array(
10
  'action' => 'file_updated',
11
+ 'object_type' => 'Themes',
12
  'object_subtype' => 'theme_unknown',
13
  'object_id' => 0,
14
  'object_name' => 'file_unknown',
32
  aal_insert_log(
33
  array(
34
  'action' => 'activated',
35
+ 'object_type' => 'Themes',
36
  'object_subtype' => $new_theme->get_stylesheet(),
37
  'object_id' => 0,
38
  'object_name' => $new_name,
43
  public function hooks_theme_customizer_modified( WP_Customize_Manager $obj ) {
44
  $aal_args = array(
45
  'action' => 'updated',
46
+ 'object_type' => 'Themes',
47
  'object_subtype' => $obj->theme()->display( 'Name' ),
48
  'object_id' => 0,
49
  'object_name' => 'Theme Customizer',
74
  aal_insert_log(
75
  array(
76
  'action' => 'deleted',
77
+ 'object_type' => 'Themes',
78
  'object_name' => $name,
79
  )
80
  );
101
  aal_insert_log(
102
  array(
103
  'action' => 'installed',
104
+ 'object_type' => 'Themes',
105
  'object_name' => $name,
106
  'object_subtype' => $version,
107
  )
125
  aal_insert_log(
126
  array(
127
  'action' => 'updated',
128
+ 'object_type' => 'Themes',
129
  'object_name' => $name,
130
  'object_subtype' => $version,
131
  )
hooks/{class-aal-hook-user.php → class-aal-hook-users.php} RENAMED
@@ -1,14 +1,14 @@
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
- class AAL_Hook_User extends AAL_Hook_Base {
5
 
6
  public function hooks_user_register( $user_id ) {
7
  $user = get_user_by( 'id', $user_id );
8
 
9
  aal_insert_log( array(
10
  'action' => 'registered',
11
- 'object_type' => 'User',
12
  'object_subtype' => 'Profile',
13
  'object_id' => $user->ID,
14
  'object_name' => $user->user_nicename,
@@ -19,7 +19,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
19
 
20
  aal_insert_log( array(
21
  'action' => 'deleted',
22
- 'object_type' => 'User',
23
  'object_subtype' => 'Profile',
24
  'object_id' => $user->ID,
25
  'object_name' => $user->user_nicename,
@@ -29,7 +29,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
29
  public function hooks_wp_login( $user_login, $user ) {
30
  aal_insert_log( array(
31
  'action' => 'logged_in',
32
- 'object_type' => 'User',
33
  'object_subtype' => 'Session',
34
  'user_id' => $user->ID,
35
  'object_id' => $user->ID,
@@ -46,7 +46,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
46
 
47
  aal_insert_log( array(
48
  'action' => 'logged_out',
49
- 'object_type' => 'User',
50
  'object_subtype' => 'Session',
51
  'user_id' => $user->ID,
52
  'object_id' => $user->ID,
@@ -59,7 +59,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
59
 
60
  aal_insert_log( array(
61
  'action' => 'updated',
62
- 'object_type' => 'User',
63
  'object_subtype' => 'Profile',
64
  'object_id' => $user->ID,
65
  'object_name' => $user->user_nicename,
@@ -73,7 +73,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
73
 
74
  aal_insert_log( array(
75
  'action' => 'failed_login',
76
- 'object_type' => 'User',
77
  'object_subtype' => 'Session',
78
  'user_id' => 0,
79
  'object_id' => 0,
1
  <?php
2
  if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
 
4
+ class AAL_Hook_Users extends AAL_Hook_Base {
5
 
6
  public function hooks_user_register( $user_id ) {
7
  $user = get_user_by( 'id', $user_id );
8
 
9
  aal_insert_log( array(
10
  'action' => 'registered',
11
+ 'object_type' => 'Users',
12
  'object_subtype' => 'Profile',
13
  'object_id' => $user->ID,
14
  'object_name' => $user->user_nicename,
19
 
20
  aal_insert_log( array(
21
  'action' => 'deleted',
22
+ 'object_type' => 'Users',
23
  'object_subtype' => 'Profile',
24
  'object_id' => $user->ID,
25
  'object_name' => $user->user_nicename,
29
  public function hooks_wp_login( $user_login, $user ) {
30
  aal_insert_log( array(
31
  'action' => 'logged_in',
32
+ 'object_type' => 'Users',
33
  'object_subtype' => 'Session',
34
  'user_id' => $user->ID,
35
  'object_id' => $user->ID,
46
 
47
  aal_insert_log( array(
48
  'action' => 'logged_out',
49
+ 'object_type' => 'Users',
50
  'object_subtype' => 'Session',
51
  'user_id' => $user->ID,
52
  'object_id' => $user->ID,
59
 
60
  aal_insert_log( array(
61
  'action' => 'updated',
62
+ 'object_type' => 'Users',
63
  'object_subtype' => 'Profile',
64
  'object_id' => $user->ID,
65
  'object_name' => $user->user_nicename,
73
 
74
  aal_insert_log( array(
75
  'action' => 'failed_login',
76
+ 'object_type' => 'Users',
77
  'object_subtype' => 'Session',
78
  'user_id' => 0,
79
  'object_id' => 0,
i18n/strings.php CHANGED
@@ -8,20 +8,20 @@ __( 'Get aware of any activities that are taking place on your dashboard! Imagin
8
  __( 'Administrator', 'aryo-activity-log' );
9
  __( 'Editor', 'aryo-activity-log' );
10
 
11
- // Post
12
- __( 'Post', 'aryo-activity-log' );
13
  __( 'created', 'aryo-activity-log' );
14
  __( 'updated', 'aryo-activity-log' );
15
  __( 'deleted', 'aryo-activity-log' );
16
  __( 'trashed', 'aryo-activity-log' );
17
  __( 'restored', 'aryo-activity-log' );
18
 
19
- // Attachment
20
- __( 'Attachment', 'aryo-activity-log' );
21
  __( 'uploaded', 'aryo-activity-log' );
22
 
23
- // User
24
- __( 'User', 'aryo-activity-log' );
25
  __( 'logged_out', 'aryo-activity-log' );
26
  __( 'logged_in', 'aryo-activity-log' );
27
  __( 'failed_login', 'aryo-activity-log' );
@@ -29,27 +29,27 @@ __( 'registered', 'aryo-activity-log' );
29
  __( 'removed', 'aryo-activity-log' );
30
 
31
  // Plugin
32
- __( 'Plugin', 'aryo-activity-log' );
33
  __( 'activated', 'aryo-activity-log' );
34
  __( 'deactivated', 'aryo-activity-log' );
35
  __( 'installed', 'aryo-activity-log' );
36
  __( 'File Updated', 'aryo-activity-log' );
37
 
38
- // Theme
39
- __( 'Theme', 'aryo-activity-log' );
40
  __( 'Theme Customizer', 'aryo-activity-log' );
41
 
42
- // Widget
43
- __( 'Widget', 'aryo-activity-log' );
44
 
45
  // Options
46
  __( 'Options', 'aryo-activity-log' );
47
 
48
- // Menu
49
- __( 'Menu', 'aryo-activity-log' );
50
 
51
- // Taxonomy
52
- __( 'Taxonomy', 'aryo-activity-log' );
53
 
54
  // Core
55
  __( 'Core', 'aryo-activity-log' );
@@ -65,8 +65,6 @@ __( 'untrashed', 'aryo-activity-log' );
65
  __( 'spammed', 'aryo-activity-log' );
66
  __( 'unspammed', 'aryo-activity-log' );
67
 
68
-
69
-
70
  // Translate Options?
71
  __( 'blogname', 'aryo-activity-log' );
72
  __( 'blogdescription', 'aryo-activity-log' );
@@ -75,6 +73,7 @@ __( 'home', 'aryo-activity-log' );
75
  __( 'admin_email', 'aryo-activity-log' );
76
  __( 'users_can_register', 'aryo-activity-log' );
77
  __( 'default_role', 'aryo-activity-log' );
 
78
  __( 'timezone_string', 'aryo-activity-log' );
79
  __( 'date_format', 'aryo-activity-log' );
80
  __( 'time_format', 'aryo-activity-log' );
@@ -140,6 +139,19 @@ __( 'permalink_structure', 'aryo-activity-log' );
140
  __( 'category_base', 'aryo-activity-log' );
141
  __( 'tag_base', 'aryo-activity-log' );
142
 
 
 
 
143
  // Export
144
  __( 'Export', 'aryo-activity-log' );
145
  __( 'downloaded', 'aryo-activity-log' );
 
 
 
 
 
 
 
 
 
 
8
  __( 'Administrator', 'aryo-activity-log' );
9
  __( 'Editor', 'aryo-activity-log' );
10
 
11
+ // Posts
12
+ __( 'Posts', 'aryo-activity-log' );
13
  __( 'created', 'aryo-activity-log' );
14
  __( 'updated', 'aryo-activity-log' );
15
  __( 'deleted', 'aryo-activity-log' );
16
  __( 'trashed', 'aryo-activity-log' );
17
  __( 'restored', 'aryo-activity-log' );
18
 
19
+ // Attachments
20
+ __( 'Attachments', 'aryo-activity-log' );
21
  __( 'uploaded', 'aryo-activity-log' );
22
 
23
+ // Users
24
+ __( 'Users', 'aryo-activity-log' );
25
  __( 'logged_out', 'aryo-activity-log' );
26
  __( 'logged_in', 'aryo-activity-log' );
27
  __( 'failed_login', 'aryo-activity-log' );
29
  __( 'removed', 'aryo-activity-log' );
30
 
31
  // Plugin
32
+ __( 'Plugins', 'aryo-activity-log' );
33
  __( 'activated', 'aryo-activity-log' );
34
  __( 'deactivated', 'aryo-activity-log' );
35
  __( 'installed', 'aryo-activity-log' );
36
  __( 'File Updated', 'aryo-activity-log' );
37
 
38
+ // Themes
39
+ __( 'Themes', 'aryo-activity-log' );
40
  __( 'Theme Customizer', 'aryo-activity-log' );
41
 
42
+ // Widgets
43
+ __( 'Widgets', 'aryo-activity-log' );
44
 
45
  // Options
46
  __( 'Options', 'aryo-activity-log' );
47
 
48
+ // Menus
49
+ __( 'Menus', 'aryo-activity-log' );
50
 
51
+ // Taxonomies
52
+ __( 'Taxonomies', 'aryo-activity-log' );
53
 
54
  // Core
55
  __( 'Core', 'aryo-activity-log' );
65
  __( 'spammed', 'aryo-activity-log' );
66
  __( 'unspammed', 'aryo-activity-log' );
67
 
 
 
68
  // Translate Options?
69
  __( 'blogname', 'aryo-activity-log' );
70
  __( 'blogdescription', 'aryo-activity-log' );
73
  __( 'admin_email', 'aryo-activity-log' );
74
  __( 'users_can_register', 'aryo-activity-log' );
75
  __( 'default_role', 'aryo-activity-log' );
76
+ __( 'WPLANG', 'aryo-activity-log' );
77
  __( 'timezone_string', 'aryo-activity-log' );
78
  __( 'date_format', 'aryo-activity-log' );
79
  __( 'time_format', 'aryo-activity-log' );
139
  __( 'category_base', 'aryo-activity-log' );
140
  __( 'tag_base', 'aryo-activity-log' );
141
 
142
+ // Privacy
143
+ __( 'wp_page_for_privacy_policy', 'aryo-activity-log' );
144
+
145
  // Export
146
  __( 'Export', 'aryo-activity-log' );
147
  __( 'downloaded', 'aryo-activity-log' );
148
+
149
+ // BC:
150
+ __( 'Post', 'aryo-activity-log' );
151
+ __( 'Attachment', 'aryo-activity-log' );
152
+ __( 'User', 'aryo-activity-log' );
153
+ __( 'Plugin', 'aryo-activity-log' );
154
+ __( 'Theme', 'aryo-activity-log' );
155
+ __( 'Widget', 'aryo-activity-log' );
156
+ __( 'Menu', 'aryo-activity-log' );
157
+ __( 'Taxonomy', 'aryo-activity-log' );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: pojo.me, KingYes, ariel.k, maor
3
  Tags: Activity Log, User Activity, User Log, Audit Log, Security, Tracking, WooCommerce, bbPress, GDPR,
4
  Requires at least: 4.4
5
  Tested up to: 5.8
6
- Stable tag: 2.7.0
7
  License: GPLv2 or later
8
 
9
  The #1 Activity Log plugin helps you monitor & log all changes and activities on your WordPress site, so you can run more securely and organized. Works simple & completely free!
@@ -108,13 +108,21 @@ Would you like to like to contribute to Activity Log? You are more than welcome
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
 
111
  = 2.7.0 - 2021-05-06 =
112
  * New: Added an option to skip or keep the failed login logs for better optimization ([#125](https://github.com/pojome/activity-log/issues/125))
113
- * Fix: Add input sanitization to avoid security issues
114
  * Tweak: Improved the activity log table with clear labels and re-order columns for better UX
115
  * Tweak: Changed the wrong_password action to failed_login in User topic
116
  * Tweak: Changed the added action to uploaded in Attachment topic
117
  * Tweak: Changed the created action to registered in User topic
 
118
 
119
  = 2.6.1 - 2021-02-15 =
120
  * Fix: Conflict with WooCommerce while you using new block editor
3
  Tags: Activity Log, User Activity, User Log, Audit Log, Security, Tracking, WooCommerce, bbPress, GDPR,
4
  Requires at least: 4.4
5
  Tested up to: 5.8
6
+ Stable tag: 2.8.0
7
  License: GPLv2 or later
8
 
9
  The #1 Activity Log plugin helps you monitor & log all changes and activities on your WordPress site, so you can run more securely and organized. Works simple & completely free!
108
 
109
  == Changelog ==
110
 
111
+ = 2.8.0 - 2021-11-17 =
112
+ * New: Added Privacy Settings to records log
113
+ * New: Added Site Language to records log
114
+ * New: Added a filter link to Topic, IP, Date, User and Action in the log table screen
115
+ * Tweak: Aligned Topics to be in plural instead of singular
116
+ * Fix: Filter by users dropdown on activity page threw a timeout error in some cases ([#141](https://github.com/pojome/activity-log/issues/141))
117
+ * Fix: CSV Export issue with comma separated values ([Topic](https://wordpress.org/support/topic/csv-export-and-comma-seperated-values/))
118
+
119
  = 2.7.0 - 2021-05-06 =
120
  * New: Added an option to skip or keep the failed login logs for better optimization ([#125](https://github.com/pojome/activity-log/issues/125))
 
121
  * Tweak: Improved the activity log table with clear labels and re-order columns for better UX
122
  * Tweak: Changed the wrong_password action to failed_login in User topic
123
  * Tweak: Changed the added action to uploaded in Attachment topic
124
  * Tweak: Changed the created action to registered in User topic
125
+ * Fix: Add input sanitization to avoid security issues
126
 
127
  = 2.6.1 - 2021-02-15 =
128
  * Fix: Conflict with WooCommerce while you using new block editor
screenshot-4.png DELETED
Binary file