Activity Log - Version 2.6.0

Version Description

  • 2020-10-19 =
  • Tweak: Added support for CloudFlare and CloudFlare Enterprise client IP header (#133)
  • Tweak: Added browser confirmation to Reset Database option
  • Tweak: Notification tab is now deprecated for new installations
  • Tweak: Added support for displaying custom role activity log (#78, #135, Topic, Topic)
  • Fix: Show user data on log-out action (#126, Topic)
  • Fix: Removed unused help context in admin to resolve deprecated WP error (Topic)
  • Fix: PHP Notices are thrown when Debug mode is active (Topic)
  • Fix: Resolve jQuery Deprecation Notice and compatibility with WordPress 5.6+ (Topic)
Download this release

Release Info

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

Code changes from version 2.5.2 to 2.6.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.5.2
9
  Text Domain: aryo-activity-log
10
  License: GPLv2 or later
11
 
@@ -37,7 +37,6 @@ include( 'classes/class-aal-settings.php' );
37
  include( 'classes/class-aal-api.php' );
38
  include( 'classes/class-aal-hooks.php' );
39
  include( 'classes/class-aal-notifications.php' );
40
- include( 'classes/class-aal-help.php' );
41
  include( 'classes/class-aal-export.php' );
42
  include( 'classes/class-aal-privacy.php' );
43
  include( 'classes/abstract-class-aal-exporter.php' );
@@ -102,7 +101,6 @@ final class AAL_Main {
102
  $this->settings = new AAL_Settings();
103
  $this->api = new AAL_API();
104
  $this->notifications = new AAL_Notifications();
105
- $this->help = new AAL_Help();
106
  $this->export = new AAL_Export();
107
  $this->privacy = new AAL_Privacy();
108
 
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.6.0
9
  Text Domain: aryo-activity-log
10
  License: GPLv2 or later
11
 
37
  include( 'classes/class-aal-api.php' );
38
  include( 'classes/class-aal-hooks.php' );
39
  include( 'classes/class-aal-notifications.php' );
 
40
  include( 'classes/class-aal-export.php' );
41
  include( 'classes/class-aal-privacy.php' );
42
  include( 'classes/abstract-class-aal-exporter.php' );
101
  $this->settings = new AAL_Settings();
102
  $this->api = new AAL_API();
103
  $this->notifications = new AAL_Notifications();
 
104
  $this->export = new AAL_Export();
105
  $this->privacy = new AAL_Privacy();
106
 
assets/js/settings.js CHANGED
@@ -1,6 +1,6 @@
1
  'use strict';
2
 
3
- ( function ( $, undefined ) {
4
  var AAL = {
5
  $wrapper: {},
6
  $container: {},
@@ -10,15 +10,15 @@
10
  var _this = this;
11
 
12
  AAL.$wrapper = $( ".aal-notifier-settings" );
13
- AAL.$container = $( "ul", this.$wrapper );
14
 
15
- AAL.counter = AAL.$container.children().size();
16
 
17
  // check if there's only one option
18
  if ( 1 === AAL.counter ) {
19
  var $temp_el = AAL.$container.children().first();
20
  // check if the "value" select box has no options
21
- if ( 0 === $temp_el.find( ".aal-value option" ).size() ) {
22
  // click the button with a timeout. Note that this is a hack that will need
23
  // to be solved server-side
24
  setTimeout( function () {
@@ -37,7 +37,7 @@
37
  e.preventDefault();
38
 
39
  // do not delete item if it's the only one left in the list
40
- if ( 1 === AAL.$container.children().size() ) {
41
  return;
42
  }
43
 
@@ -98,13 +98,10 @@
98
  }
99
  };
100
 
101
- $( function () {
102
- AAL.init();
103
- });
104
 
105
  window.AAL = AAL;
106
 
107
-
108
  /**
109
  * Form serialization helper
110
  */
@@ -123,4 +120,4 @@
123
  } );
124
  return o;
125
  };
126
- })( jQuery );
1
  'use strict';
2
 
3
+ jQuery( function( $ ) {
4
  var AAL = {
5
  $wrapper: {},
6
  $container: {},
10
  var _this = this;
11
 
12
  AAL.$wrapper = $( ".aal-notifier-settings" );
13
+ AAL.$container = $( "ul", AAL.$wrapper );
14
 
15
+ AAL.counter = AAL.$container.children().length;
16
 
17
  // check if there's only one option
18
  if ( 1 === AAL.counter ) {
19
  var $temp_el = AAL.$container.children().first();
20
  // check if the "value" select box has no options
21
+ if ( 0 === $temp_el.find( ".aal-value option" ).length ) {
22
  // click the button with a timeout. Note that this is a hack that will need
23
  // to be solved server-side
24
  setTimeout( function () {
37
  e.preventDefault();
38
 
39
  // do not delete item if it's the only one left in the list
40
+ if ( 1 === AAL.$container.children().length ) {
41
  return;
42
  }
43
 
98
  }
99
  };
100
 
101
+ AAL.init();
 
 
102
 
103
  window.AAL = AAL;
104
 
 
105
  /**
106
  * Form serialization helper
107
  */
120
  } );
121
  return o;
122
  };
123
+ });
classes/class-aal-activity-log-list-table.php CHANGED
@@ -93,10 +93,19 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
93
  )
94
  );
95
 
 
 
 
 
 
 
 
 
 
96
  $this->_caps = apply_filters(
97
  'aal_init_caps',
98
  array(
99
- 'administrator' => array( 'administrator', 'editor', 'author', 'guest' ),
100
  'editor' => array( 'editor', 'author', 'guest' ),
101
  'author' => array( 'author', 'guest' ),
102
  )
93
  )
94
  );
95
 
96
+ $default_rules = array( 'administrator', 'editor', 'author', 'guest' );
97
+
98
+ global $wp_roles;
99
+
100
+ $all_roles = array();
101
+ foreach ( $wp_roles->roles as $key=>$wp_role ) {
102
+ $all_roles[] = $key;
103
+ }
104
+
105
  $this->_caps = apply_filters(
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
  )
classes/class-aal-api.php CHANGED
@@ -33,6 +33,8 @@ class AAL_API {
33
  */
34
  protected function _get_ip_address() {
35
  $server_ip_keys = array(
 
 
36
  'HTTP_CLIENT_IP',
37
  'HTTP_X_FORWARDED_FOR',
38
  'HTTP_X_FORWARDED',
33
  */
34
  protected function _get_ip_address() {
35
  $server_ip_keys = array(
36
+ 'HTTP_CF_CONNECTING_IP', // CloudFlare
37
+ 'HTTP_TRUE_CLIENT_IP', // CloudFlare Enterprise header
38
  'HTTP_CLIENT_IP',
39
  'HTTP_X_FORWARDED_FOR',
40
  'HTTP_X_FORWARDED',
classes/class-aal-help.php DELETED
@@ -1,31 +0,0 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
-
4
- /**
5
- * Contextual help texts
6
- *
7
- * Class AAL_Help
8
- */
9
- class AAL_Help {
10
-
11
- public function __construct() {
12
- add_action( 'in_admin_header', array( $this, 'contextual_help' ) );
13
- }
14
-
15
- public function contextual_help() {
16
- $screen = get_current_screen();
17
-
18
- switch ( $screen->id ) {
19
- case 'activity-log_page_activity-log-settings':
20
- $screen->add_help_tab( array(
21
- 'title' => __( 'Overview', 'aryo-activity-log' ),
22
- 'id' => 'aal-overview',
23
- 'content' => '
24
- <h3>' . __( 'Notifications', 'aryo-activity-log' ) . '</h3>
25
- <p>' . __( 'This screen lets you control what will happen once a user on your site does something you define. For instance, let us assume that you have created a user on your site
26
- for your content editor. Now, let\'s say that every time that user updates a post, you want to know about it. You can easily do it from this page.', 'aryo-activity-log' ) . '</p>',
27
- ) );
28
- break;
29
- }
30
- }
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class-aal-settings.php CHANGED
@@ -165,7 +165,7 @@ class AAL_Settings {
165
  'id' => 'notification_transport',
166
  'page' => $this->slug,
167
  'name' => "{$this->slug}[notification_handlers][{$handler_id}]",
168
- 'value' => (bool) ( 1 == $enabled_notification_handlers[ $handler_id ] ),
169
  )
170
  );
171
 
@@ -194,11 +194,21 @@ class AAL_Settings {
194
  $current_section = $this->get_setup_section();
195
  $sections = array(
196
  'general' => __( 'General', 'aryo-activity-log' ),
197
- 'notifications' => __( 'Notifications', 'aryo-activity-log' ),
198
  );
199
 
 
 
 
 
 
 
 
200
  $sections = apply_filters( 'aal_setup_sections', $sections );
201
 
 
 
 
 
202
  foreach ( $sections as $section_key => $section_caption ) {
203
  $active = $current_section === $section_key ? 'nav-tab-active' : '';
204
  $url = add_query_arg( 'aal_section', $section_key );
@@ -253,7 +263,7 @@ class AAL_Settings {
253
  <script type="text/javascript">
254
  jQuery( document ).ready( function( $ ) {
255
  $( '#aal-delete-log-activities' ).on( 'click', function( e ) {
256
- if ( ! confirm( '<?php echo __( 'Are you sure you want to do this action?', 'aryo-activity-log' ); ?>' ) ) {
257
  e.preventDefault();
258
  }
259
  } );
165
  'id' => 'notification_transport',
166
  'page' => $this->slug,
167
  'name' => "{$this->slug}[notification_handlers][{$handler_id}]",
168
+ 'value' => isset( $enabled_notification_handlers[ $handler_id ] ) && ( 1 == $enabled_notification_handlers[ $handler_id ] ),
169
  )
170
  );
171
 
194
  $current_section = $this->get_setup_section();
195
  $sections = array(
196
  'general' => __( 'General', 'aryo-activity-log' ),
 
197
  );
198
 
199
+ $enabled_notification_handlers = AAL_Main::instance()->settings->get_option( 'notification_handlers' );
200
+
201
+ // Hide notifications tab if not used before..
202
+ if ( ! empty( $enabled_notification_handlers ) ) {
203
+ $sections['notifications'] = __( 'Notifications', 'aryo-activity-log' );
204
+ }
205
+
206
  $sections = apply_filters( 'aal_setup_sections', $sections );
207
 
208
+ if ( 1 >= count( $sections ) ) {
209
+ return;
210
+ }
211
+
212
  foreach ( $sections as $section_key => $section_caption ) {
213
  $active = $current_section === $section_key ? 'nav-tab-active' : '';
214
  $url = add_query_arg( 'aal_section', $section_key );
263
  <script type="text/javascript">
264
  jQuery( document ).ready( function( $ ) {
265
  $( '#aal-delete-log-activities' ).on( 'click', function( e ) {
266
+ if ( ! confirm( '<?php echo __( 'Attention: We are going to DELETE ALL ACTIVITIES from the database. Are you sure you want to do that?', 'aryo-activity-log' ); ?>' ) ) {
267
  e.preventDefault();
268
  }
269
  } );
hooks/class-aal-hook-posts.php CHANGED
@@ -57,6 +57,10 @@ class AAL_Hook_Posts extends AAL_Hook_Base {
57
 
58
  $post = get_post( $post_id );
59
 
 
 
 
 
60
  if ( in_array( $post->post_status, array( 'auto-draft', 'inherit' ) ) )
61
  return;
62
 
57
 
58
  $post = get_post( $post_id );
59
 
60
+ if ( ! $post ) {
61
+ return;
62
+ }
63
+
64
  if ( in_array( $post->post_status, array( 'auto-draft', 'inherit' ) ) )
65
  return;
66
 
hooks/class-aal-hook-user.php CHANGED
@@ -34,9 +34,13 @@ class AAL_Hook_User extends AAL_Hook_Base {
34
  ) );
35
  }
36
 
37
- public function hooks_wp_logout() {
38
  $user = wp_get_current_user();
39
 
 
 
 
 
40
  aal_insert_log( array(
41
  'action' => 'logged_out',
42
  'object_type' => 'User',
@@ -69,7 +73,7 @@ class AAL_Hook_User extends AAL_Hook_Base {
69
 
70
  public function __construct() {
71
  add_action( 'wp_login', array( &$this, 'hooks_wp_login' ), 10, 2 );
72
- add_action( 'wp_logout', array( &$this, 'hooks_wp_logout' ) );
73
  add_action( 'delete_user', array( &$this, 'hooks_delete_user' ) );
74
  add_action( 'user_register', array( &$this, 'hooks_user_register' ) );
75
  add_action( 'profile_update', array( &$this, 'hooks_profile_update' ) );
34
  ) );
35
  }
36
 
37
+ public function hooks_clear_auth_cookie() {
38
  $user = wp_get_current_user();
39
 
40
+ if ( empty( $user ) || ! $user->exists() ) {
41
+ return;
42
+ }
43
+
44
  aal_insert_log( array(
45
  'action' => 'logged_out',
46
  'object_type' => 'User',
73
 
74
  public function __construct() {
75
  add_action( 'wp_login', array( &$this, 'hooks_wp_login' ), 10, 2 );
76
+ add_action( 'clear_auth_cookie', array( &$this, 'hooks_clear_auth_cookie' ) );
77
  add_action( 'delete_user', array( &$this, 'hooks_delete_user' ) );
78
  add_action( 'user_register', array( &$this, 'hooks_user_register' ) );
79
  add_action( 'profile_update', array( &$this, 'hooks_profile_update' ) );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: pojo.me, KingYes, ariel.k, maor
3
  Tags: Activity Log, Security Log, User Activity, User Log, Activity, audit log, monitor, security, tracking, woocommerce, bbPress,
4
  Requires at least: 4.4
5
- Tested up to: 5.0
6
- Stable tag: 2.5.2
7
  License: GPLv2 or later
8
 
9
  The #1 Activity Log plugin helps you monitor & log all changes and activities on your site, so you can run a safer, more organized WordPress site.
@@ -112,6 +112,16 @@ Would you like to like to contribute to Activity Log? You are more than welcome
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
 
 
 
 
 
115
  = 2.5.2 =
116
  * Fix: Conflict with Elementor and WordPress Widgets
117
 
2
  Contributors: pojo.me, KingYes, ariel.k, maor
3
  Tags: Activity Log, Security Log, User Activity, User Log, Activity, audit log, monitor, security, tracking, woocommerce, bbPress,
4
  Requires at least: 4.4
5
+ Tested up to: 5.6
6
+ Stable tag: 2.6.0
7
  License: GPLv2 or later
8
 
9
  The #1 Activity Log plugin helps you monitor & log all changes and activities on your site, so you can run a safer, more organized WordPress site.
112
 
113
  == Changelog ==
114
 
115
+ = 2.6.0 - 2020-10-19 =
116
+ * Tweak: Added support for CloudFlare and CloudFlare Enterprise client IP header ([#133](https://github.com/pojome/activity-log/issues/133))
117
+ * Tweak: Added browser confirmation to Reset Database option
118
+ * Tweak: Notification tab is now deprecated for new installations
119
+ * Tweak: Added support for displaying custom role activity log ([#78](https://github.com/pojome/activity-log/issues/78), [#135](https://github.com/pojome/activity-log/issues/135), [Topic](https://wordpress.org/support/topic/only-shows-logs-for-admin/), [Topic](https://wordpress.org/support/topic/no-logs-for-most-created-roles/))
120
+ * Fix: Show user data on log-out action ([#126](https://github.com/pojome/activity-log/issues/126), [Topic](https://wordpress.org/support/topic/logout-hook-event/))
121
+ * Fix: Removed unused help context in admin to resolve deprecated WP error ([Topic](https://wordpress.org/support/topic/deprecated-function-in-debug-log/))
122
+ * Fix: PHP Notices are thrown when Debug mode is active ([Topic](https://wordpress.org/support/topic/php-errors-infomational/))
123
+ * Fix: Resolve jQuery Deprecation Notice and compatibility with WordPress 5.6+ ([Topic](https://wordpress.org/support/topic/jquery-deprecation-notice-jquery-fn-size/))
124
+
125
  = 2.5.2 =
126
  * Fix: Conflict with Elementor and WordPress Widgets
127