Activity Log - Version 2.1.13

Version Description

  • New! Added filter by User Roles (#67)
Download this release

Release Info

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

Code changes from version 2.1.12 to 2.1.13

aryo-activity-log.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://wordpress.org/plugins/aryo-activity-log/
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: Yakir Sitbon, Maor Chasen, Ariel Klikstein
7
  Author URI: http://www.aryodigital.com
8
- Version: 2.1.12
9
  Text Domain: aryo-aal
10
  Domain Path: /language/
11
  License: GPLv2 or later
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: Yakir Sitbon, Maor Chasen, Ariel Klikstein
7
  Author URI: http://www.aryodigital.com
8
+ Version: 2.1.13
9
  Text Domain: aryo-aal
10
  Domain Path: /language/
11
  License: GPLv2 or later
classes/class-aal-activity-log-list-table.php CHANGED
@@ -11,14 +11,40 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
11
  protected $_roles = array();
12
 
13
  protected $_caps = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  protected function _get_where_by_role() {
16
  $allow_modules = array();
17
 
18
- $user = get_user_by( 'id', get_current_user_id() );
19
- if ( ! $user )
20
- wp_die( 'No allowed here.' );
21
-
22
  foreach ( $this->_roles as $key => $role ) {
23
  if ( current_user_can( $key ) || current_user_can( 'view_all_aryo_activity_log' ) ) {
24
  $allow_modules = array_merge( $allow_modules, $role );
@@ -33,26 +59,9 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
33
  $where = array();
34
  foreach ( $allow_modules as $type )
35
  $where[] .= '`object_type` = \'' . $type . '\'';
36
-
37
- $user_cap = strtolower( key( $user->caps ) );
38
- $allow_caps = $where_caps = array();
39
 
40
- foreach ( $this->_caps as $key => $cap_allow ) {
41
- if ( $key === $user_cap ) {
42
- $allow_caps = array_merge( $allow_caps, $cap_allow );
43
- break;
44
- }
45
- }
46
-
47
- // TODO: Find better way to Multisite compatibility.
48
- if ( is_super_admin() || current_user_can( 'view_all_aryo_activity_log' ) )
49
- $allow_caps = $this->_caps['administrator'];
50
-
51
- if ( empty( $allow_caps ) )
52
- wp_die( 'No allowed here.' );
53
-
54
- $allow_caps = array_unique( $allow_caps );
55
- foreach ( $allow_caps as $cap )
56
  $where_caps[] .= '`user_caps` = \'' . $cap . '\'';
57
 
58
  return 'AND (' . implode( ' OR ', $where ) . ') AND (' . implode( ' OR ', $where_caps ) . ')';
@@ -247,6 +256,23 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
247
  ) );
248
 
249
  if ( $users ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  if ( ! isset( $_REQUEST['usershow'] ) )
251
  $_REQUEST['usershow'] = '';
252
 
@@ -341,9 +367,13 @@ class AAL_Activity_Log_List_Table extends WP_List_Table {
341
  $where .= $wpdb->prepare( ' AND `user_id` = %d', $_REQUEST['usershow'] );
342
  }
343
 
 
 
 
 
344
  if ( isset( $_REQUEST['dateshow'] ) && in_array( $_REQUEST['dateshow'], array( 'today', 'yesterday', 'week', 'month' ) ) ) {
345
  $current_time = current_time( 'timestamp' );
346
-
347
  // Today
348
  $start_time = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );;
349
  $end_time = mktime( 23, 59, 59, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
11
  protected $_roles = array();
12
 
13
  protected $_caps = array();
14
+
15
+ protected $_allow_caps = array();
16
+
17
+ protected function _get_allow_caps() {
18
+ if ( empty( $this->_allow_caps ) ) {
19
+ $user = get_user_by( 'id', get_current_user_id() );
20
+ if ( ! $user )
21
+ wp_die( 'No allowed here.' );
22
+
23
+ $user_cap = strtolower( key( $user->caps ) );
24
+ $allow_caps = array();
25
+
26
+ foreach ( $this->_caps as $key => $cap_allow ) {
27
+ if ( $key === $user_cap ) {
28
+ $allow_caps = array_merge( $allow_caps, $cap_allow );
29
+ break;
30
+ }
31
+ }
32
+
33
+ // TODO: Find better way to Multisite compatibility.
34
+ if ( is_super_admin() || current_user_can( 'view_all_aryo_activity_log' ) )
35
+ $allow_caps = $this->_caps['administrator'];
36
+
37
+ if ( empty( $allow_caps ) )
38
+ wp_die( 'No allowed here.' );
39
+
40
+ $this->_allow_caps = array_unique( $allow_caps );
41
+ }
42
+ return $this->_allow_caps;
43
+ }
44
 
45
  protected function _get_where_by_role() {
46
  $allow_modules = array();
47
 
 
 
 
 
48
  foreach ( $this->_roles as $key => $role ) {
49
  if ( current_user_can( $key ) || current_user_can( 'view_all_aryo_activity_log' ) ) {
50
  $allow_modules = array_merge( $allow_modules, $role );
59
  $where = array();
60
  foreach ( $allow_modules as $type )
61
  $where[] .= '`object_type` = \'' . $type . '\'';
 
 
 
62
 
63
+ $where_caps = array();
64
+ foreach ( $this->_get_allow_caps() as $cap )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  $where_caps[] .= '`user_caps` = \'' . $cap . '\'';
66
 
67
  return 'AND (' . implode( ' OR ', $where ) . ') AND (' . implode( ' OR ', $where_caps ) . ')';
256
  ) );
257
 
258
  if ( $users ) {
259
+ if ( ! isset( $_REQUEST['capshow'] ) )
260
+ $_REQUEST['capshow'] = '';
261
+
262
+ $output = array();
263
+ foreach ( $this->_get_allow_caps() as $cap ) {
264
+ $output[ $cap ] = __( ucwords( $cap ), 'aryo-aal' );
265
+ }
266
+
267
+ if ( ! empty( $output ) ) {
268
+ echo '<select name="capshow" id="hs-filter-capshow">';
269
+ printf( '<option value="">%s</option>', __( 'All Roles', 'aryo-aal' ) );
270
+ foreach ( $output as $key => $value ) {
271
+ printf( '<option value="%s"%s>%s</option>', $key, selected( $_REQUEST['capshow'], $key, false ), $value );
272
+ }
273
+ echo '</select>';
274
+ }
275
+
276
  if ( ! isset( $_REQUEST['usershow'] ) )
277
  $_REQUEST['usershow'] = '';
278
 
367
  $where .= $wpdb->prepare( ' AND `user_id` = %d', $_REQUEST['usershow'] );
368
  }
369
 
370
+ if ( isset( $_REQUEST['capshow'] ) && '' !== $_REQUEST['capshow'] ) {
371
+ $where .= $wpdb->prepare( ' AND `user_caps` = \'%s\'', strtolower( $_REQUEST['capshow'] ) );
372
+ }
373
+
374
  if ( isset( $_REQUEST['dateshow'] ) && in_array( $_REQUEST['dateshow'], array( 'today', 'yesterday', 'week', 'month' ) ) ) {
375
  $current_time = current_time( 'timestamp' );
376
+
377
  // Today
378
  $start_time = mktime( 0, 0, 0, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );;
379
  $end_time = mktime( 23, 59, 59, date( 'm', $current_time ), date( 'd', $current_time ), date( 'Y', $current_time ) );
language/aryo-aal.pot CHANGED
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: aryo-activity-log 2.1.12\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2014-09-30 08:37+0300\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -21,85 +21,89 @@ msgstr ""
21
  msgid "Cheatin&#8217; huh?"
22
  msgstr ""
23
 
24
- #: classes/class-aal-activity-log-list-table.php:92
25
  msgid "Activities"
26
  msgstr ""
27
 
28
- #: classes/class-aal-activity-log-list-table.php:103
29
  msgid "Date"
30
  msgstr ""
31
 
32
- #: classes/class-aal-activity-log-list-table.php:104
33
  msgid "Author"
34
  msgstr ""
35
 
36
- #: classes/class-aal-activity-log-list-table.php:105
37
  msgid "IP"
38
  msgstr ""
39
 
40
- #: classes/class-aal-activity-log-list-table.php:106
41
  msgid "Type"
42
  msgstr ""
43
 
44
- #: classes/class-aal-activity-log-list-table.php:107
45
  msgid "Label"
46
  msgstr ""
47
 
48
- #: classes/class-aal-activity-log-list-table.php:108
49
  msgid "Action"
50
  msgstr ""
51
 
52
- #: classes/class-aal-activity-log-list-table.php:109
53
  msgid "Description"
54
  msgstr ""
55
 
56
- #: classes/class-aal-activity-log-list-table.php:129
57
  #, php-format
58
  msgid "%s ago"
59
  msgstr ""
60
 
61
- #: classes/class-aal-activity-log-list-table.php:156
62
  msgid "Unknown"
63
  msgstr ""
64
 
65
- #: classes/class-aal-activity-log-list-table.php:162
66
- #: classes/class-aal-activity-log-list-table.php:256
67
  msgid "Guest"
68
  msgstr ""
69
 
70
- #: classes/class-aal-activity-log-list-table.php:201
71
  msgid "All"
72
  msgstr ""
73
 
74
- #: classes/class-aal-activity-log-list-table.php:267
 
 
 
 
75
  msgid "All Users"
76
  msgstr ""
77
 
78
- #: classes/class-aal-activity-log-list-table.php:294
79
  msgid "All Types"
80
  msgstr ""
81
 
82
- #: classes/class-aal-activity-log-list-table.php:305
83
  msgid "All Time"
84
  msgstr ""
85
 
86
- #: classes/class-aal-activity-log-list-table.php:306
87
  msgid "Today"
88
  msgstr ""
89
 
90
- #: classes/class-aal-activity-log-list-table.php:307
91
  msgid "Yesterday"
92
  msgstr ""
93
 
94
- #: classes/class-aal-activity-log-list-table.php:308
95
  msgid "Week"
96
  msgstr ""
97
 
98
- #: classes/class-aal-activity-log-list-table.php:309
99
  msgid "Month"
100
  msgstr ""
101
 
102
- #: classes/class-aal-activity-log-list-table.php:316
103
  msgid "Filter"
104
  msgstr ""
105
 
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: aryo-activity-log 2.1.13\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2014-12-04 19:47+0200\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
21
  msgid "Cheatin&#8217; huh?"
22
  msgstr ""
23
 
24
+ #: classes/class-aal-activity-log-list-table.php:101
25
  msgid "Activities"
26
  msgstr ""
27
 
28
+ #: classes/class-aal-activity-log-list-table.php:112
29
  msgid "Date"
30
  msgstr ""
31
 
32
+ #: classes/class-aal-activity-log-list-table.php:113
33
  msgid "Author"
34
  msgstr ""
35
 
36
+ #: classes/class-aal-activity-log-list-table.php:114
37
  msgid "IP"
38
  msgstr ""
39
 
40
+ #: classes/class-aal-activity-log-list-table.php:115
41
  msgid "Type"
42
  msgstr ""
43
 
44
+ #: classes/class-aal-activity-log-list-table.php:116
45
  msgid "Label"
46
  msgstr ""
47
 
48
+ #: classes/class-aal-activity-log-list-table.php:117
49
  msgid "Action"
50
  msgstr ""
51
 
52
+ #: classes/class-aal-activity-log-list-table.php:118
53
  msgid "Description"
54
  msgstr ""
55
 
56
+ #: classes/class-aal-activity-log-list-table.php:138
57
  #, php-format
58
  msgid "%s ago"
59
  msgstr ""
60
 
61
+ #: classes/class-aal-activity-log-list-table.php:165
62
  msgid "Unknown"
63
  msgstr ""
64
 
65
+ #: classes/class-aal-activity-log-list-table.php:171
66
+ #: classes/class-aal-activity-log-list-table.php:282
67
  msgid "Guest"
68
  msgstr ""
69
 
70
+ #: classes/class-aal-activity-log-list-table.php:210
71
  msgid "All"
72
  msgstr ""
73
 
74
+ #: classes/class-aal-activity-log-list-table.php:269
75
+ msgid "All Roles"
76
+ msgstr ""
77
+
78
+ #: classes/class-aal-activity-log-list-table.php:293
79
  msgid "All Users"
80
  msgstr ""
81
 
82
+ #: classes/class-aal-activity-log-list-table.php:320
83
  msgid "All Types"
84
  msgstr ""
85
 
86
+ #: classes/class-aal-activity-log-list-table.php:331
87
  msgid "All Time"
88
  msgstr ""
89
 
90
+ #: classes/class-aal-activity-log-list-table.php:332
91
  msgid "Today"
92
  msgstr ""
93
 
94
+ #: classes/class-aal-activity-log-list-table.php:333
95
  msgid "Yesterday"
96
  msgstr ""
97
 
98
+ #: classes/class-aal-activity-log-list-table.php:334
99
  msgid "Week"
100
  msgstr ""
101
 
102
+ #: classes/class-aal-activity-log-list-table.php:335
103
  msgid "Month"
104
  msgstr ""
105
 
106
+ #: classes/class-aal-activity-log-list-table.php:342
107
  msgid "Filter"
108
  msgstr ""
109
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: pojo.me, KingYes, ariel.k, maor
3
  Tags: administration, activity, event, monitor, multisite, multi-users, log, logger, audit log, stats, security, tracking, woocommerce, notifications, email notifications
4
  Requires at least: 3.5
5
  Tested up to: 4.0
6
- Stable tag: 2.1.12
7
  License: GPLv2 or later
8
 
9
  Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.
@@ -91,6 +91,9 @@ Would you like to like to contribute to Activity Log? You are more than welcome
91
 
92
  == Changelog ==
93
 
 
 
 
94
  = 2.1.12 =
95
  * New! Added translate: Turkish (tr_TR) - Thanks to [Ahmet Kolcu](http://ahmetkolcu.org)
96
 
3
  Tags: administration, activity, event, monitor, multisite, multi-users, log, logger, audit log, stats, security, tracking, woocommerce, notifications, email notifications
4
  Requires at least: 3.5
5
  Tested up to: 4.0
6
+ Stable tag: 2.1.13
7
  License: GPLv2 or later
8
 
9
  Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site.
91
 
92
  == Changelog ==
93
 
94
+ = 2.1.13 =
95
+ * New! Added filter by User Roles ([#67](https://github.com/KingYes/wordpress-aryo-activity-log/issues/67))
96
+
97
  = 2.1.12 =
98
  * New! Added translate: Turkish (tr_TR) - Thanks to [Ahmet Kolcu](http://ahmetkolcu.org)
99