Simple History - Version 2.5.1

Version Description

(December 2015) =

  • Fixed: No longer assume that the ajaxurl don't already contains query params. Should fix problems with third party plugins like WPML.
  • Fixed: Notice if context key did not exist. Should fix https://github.com/bonny/WordPress-Simple-History/issues/100.
  • Fixed: Name and title on dashboard and settings page were not translateable. Fixes https://wordpress.org/support/topic/dashboard-max-length-of-content.
  • Fixed: Typo when user resets password.
  • Added: Filter simple_history/row_header_date_output.
  • Added: Filter simple_history/log/inserted.
  • Added: Filter simple_history/row_header_date_output.
Download this release

Release Info

Developer eskapism
Plugin Icon 128x128 Simple History
Version 2.5.1
Comparing to
See all releases

Code changes from version 2.5 to 2.5.1

dropins/SimpleHistoryDonateDropin.php CHANGED
@@ -71,7 +71,7 @@ class SimpleHistoryDonateDropin {
71
  function settings_section_output() {
72
 
73
  printf(
74
- __( 'If you find Simple History useful please <a href="%1$s">donate</a> or <a href="%2$s">buy me something from my Amazon wish list</a>.', "simple-history"),
75
  "http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=pluginpage&utm_campaign=simplehistory",
76
  "http://www.amazon.co.uk/registry/wishlist/IAEZWNLQQICG"
77
  );
71
  function settings_section_output() {
72
 
73
  printf(
74
+ __( 'If you find Simple History useful please <a href="%1$s">donate</a>.', "simple-history"),
75
  "http://eskapism.se/sida/donate/?utm_source=wordpress&utm_medium=pluginpage&utm_campaign=simplehistory",
76
  "http://www.amazon.co.uk/registry/wishlist/IAEZWNLQQICG"
77
  );
dropins/SimpleHistorySidebarDropin.php CHANGED
@@ -108,15 +108,26 @@ class SimpleHistorySidebarDropin {
108
  ',
109
  _x("Add more to the log", "Sidebar box", "simple-history"), // 1
110
  _x("Are there things you miss in the history log?", "Sidebar box", "simple-history") // 2
 
111
 
112
- // Add events yourself using the Logger API
113
- // Tell the developer
114
 
 
 
 
 
 
 
 
 
 
 
 
115
  );
116
- //echo $boxMissingEvents;
117
 
118
  $arrBoxes = array(
119
  "boxReview" => $boxReview,
 
120
  // "boxMissingEvents" => $boxMissingEvents,
121
  "boxDonate" => $boxDonate,
122
  // "boxGithub" => $boxGithub,
108
  ',
109
  _x("Add more to the log", "Sidebar box", "simple-history"), // 1
110
  _x("Are there things you miss in the history log?", "Sidebar box", "simple-history") // 2
111
+ );
112
 
 
 
113
 
114
+ // Box about support
115
+ $boxSupport = sprintf( '
116
+ <div class="postbox">
117
+ <h3 class="hndle">%1$s</h3>
118
+ <div class="inside">
119
+ <p>%2$s</p>
120
+ </div>
121
+ </div>
122
+ ',
123
+ _x("Support", "Sidebar box", "simple-history"), // 1
124
+ sprintf( _x('<a href="%1$s">Visit the support forum</a> if you need help or have questions.', "Sidebar box", "simple-history"), 'https://wordpress.org/support/plugin/simple-history' ) // 2
125
  );
126
+
127
 
128
  $arrBoxes = array(
129
  "boxReview" => $boxReview,
130
+ "boxSupport" => $boxSupport,
131
  // "boxMissingEvents" => $boxMissingEvents,
132
  "boxDonate" => $boxDonate,
133
  // "boxGithub" => $boxGithub,
examples/examples.php CHANGED
@@ -192,6 +192,15 @@ add_filter("simple_history/simple_logger/log_message_key", function($doLog, $log
192
  // Never clear the log (default is 60 days)
193
  add_filter("simple_history/db_purge_days_interval", "__return_zero");
194
 
 
 
 
 
 
 
 
 
 
195
  // Don't let anyone - even with the correct secret - view the RSS feed
196
  add_filter("simple_history/rss_feed_show", "__return_false");
197
 
192
  // Never clear the log (default is 60 days)
193
  add_filter("simple_history/db_purge_days_interval", "__return_zero");
194
 
195
+ // Clear items that are older than a 7 days (i.e. keep only the most recent 7 days in the log)
196
+ add_filter( "simple_history/db_purge_days_interval", function( $days ) {
197
+
198
+ $days = 7;
199
+
200
+ return $days;
201
+
202
+ } );
203
+
204
  // Don't let anyone - even with the correct secret - view the RSS feed
205
  add_filter("simple_history/rss_feed_show", "__return_false");
206
 
inc/SimpleHistory.php CHANGED
@@ -1537,7 +1537,7 @@ Because Simple History was just recently installed, this feed does not contain m
1537
  if ( $show_dashboard_page ) {
1538
 
1539
  add_dashboard_page(
1540
- SimpleHistory::NAME,
1541
  _x( "Simple History", 'dashboard menu name', 'simple-history' ),
1542
  $this->get_view_history_capability(),
1543
  "simple_history_page",
@@ -1557,7 +1557,7 @@ Because Simple History was just recently installed, this feed does not contain m
1557
 
1558
  add_options_page(
1559
  __( 'Simple History Settings', "simple-history" ),
1560
- SimpleHistory::NAME,
1561
  $this->get_view_settings_capability(),
1562
  SimpleHistory::SETTINGS_MENU_SLUG,
1563
  array( $this, 'settings_page_output' )
1537
  if ( $show_dashboard_page ) {
1538
 
1539
  add_dashboard_page(
1540
+ _x( "Simple History", 'dashboard title name', 'simple-history' ),
1541
  _x( "Simple History", 'dashboard menu name', 'simple-history' ),
1542
  $this->get_view_history_capability(),
1543
  "simple_history_page",
1557
 
1558
  add_options_page(
1559
  __( 'Simple History Settings', "simple-history" ),
1560
+ _x( 'Simple History', "Options page menu title", "simple-history" ),
1561
  $this->get_view_settings_capability(),
1562
  SimpleHistory::SETTINGS_MENU_SLUG,
1563
  array( $this, 'settings_page_output' )
index.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://simple-history.com
5
  Text Domain: simple-history
6
  Domain Path: /languages
7
  Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
- Version: 2.5
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
@@ -42,7 +42,7 @@ if ( version_compare( phpversion(), "5.3", ">=") ) {
42
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
43
 
44
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
45
- define( 'SIMPLE_HISTORY_VERSION', '2.5' );
46
  }
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
5
  Text Domain: simple-history
6
  Domain Path: /languages
7
  Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
+ Version: 2.5.1
9
  Author: Pär Thernström
10
  Author URI: http://simple-history.com/
11
  License: GPL2
42
  // register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
43
 
44
  if ( ! defined( 'SIMPLE_HISTORY_VERSION' ) ) {
45
+ define( 'SIMPLE_HISTORY_VERSION', '2.5.1' );
46
  }
47
 
48
  if ( ! defined( 'SIMPLE_HISTORY_PATH' ) ) {
js/scripts.js CHANGED
@@ -2,7 +2,16 @@
2
 
3
  var simple_history = (function($) {
4
 
5
- var api_base_url = window.ajaxurl + "?action=simple_history_api";
 
 
 
 
 
 
 
 
 
6
 
7
  var debug = function(what) {
8
 
2
 
3
  var simple_history = (function($) {
4
 
5
+ var api_base_url = window.ajaxurl;
6
+
7
+ // Plugins may have modified the Ajax URL so it already contains query params
8
+ if (api_base_url.indexOf("?") >= 0) {
9
+ api_base_url += "&";
10
+ } else {
11
+ api_base_url += "?";
12
+ }
13
+
14
+ api_base_url += "action=simple_history_api";
15
 
16
  var debug = function(what) {
17
 
loggers/SimpleLogger.php CHANGED
@@ -38,7 +38,7 @@ class SimpleLogger {
38
  /**
39
  * ID of last inserted row. Used when chaining methods.
40
  */
41
- private $lastInsertID;
42
 
43
  /**
44
  * Constructor. Remember to call this as parent constructor if making a childlogger
@@ -445,6 +445,16 @@ class SimpleLogger {
445
  $date_html .= "</a>";
446
  $date_html .= "</span>";
447
 
 
 
 
 
 
 
 
 
 
 
448
  // Loglevel
449
  // SimpleHistoryLogitem--loglevel-warning
450
  /*
@@ -1202,8 +1212,10 @@ class SimpleLogger {
1202
  *
1203
  * @param array $context Array with all context data to store. Modify and return this.
1204
  * @param array $data Array with data used for parent row.
 
1205
  */
1206
- $context = apply_filters("simple_history/log_insert_context", $context, $data);
 
1207
 
1208
  // Insert all context values into db
1209
  foreach ( $context as $key => $value ) {
@@ -1229,11 +1241,22 @@ class SimpleLogger {
1229
  }
1230
 
1231
  }
1232
-
1233
  $this->lastInsertID = $history_inserted_id;
1234
 
1235
  $this->simpleHistory->get_cache_incrementor(true);
1236
 
 
 
 
 
 
 
 
 
 
 
 
1237
  // Return $this so we can chain methods
1238
  return $this;
1239
 
38
  /**
39
  * ID of last inserted row. Used when chaining methods.
40
  */
41
+ public $lastInsertID;
42
 
43
  /**
44
  * Constructor. Remember to call this as parent constructor if making a childlogger
445
  $date_html .= "</a>";
446
  $date_html .= "</span>";
447
 
448
+ /**
449
+ * Filter the output of the date section of the header.
450
+ *
451
+ * @since 2.5.1
452
+ *
453
+ * @param String $date_html
454
+ * @param array $row
455
+ */
456
+ $date_html = apply_filters("simple_history/row_header_date_output", $date_html, $row);
457
+
458
  // Loglevel
459
  // SimpleHistoryLogitem--loglevel-warning
460
  /*
1212
  *
1213
  * @param array $context Array with all context data to store. Modify and return this.
1214
  * @param array $data Array with data used for parent row.
1215
+ * @param array $this Reference to this logger instance
1216
  */
1217
+ $context = apply_filters("simple_history/log_insert_context", $context, $data, $this);
1218
+ $data_parent_row = $data;
1219
 
1220
  // Insert all context values into db
1221
  foreach ( $context as $key => $value ) {
1241
  }
1242
 
1243
  }
1244
+
1245
  $this->lastInsertID = $history_inserted_id;
1246
 
1247
  $this->simpleHistory->get_cache_incrementor(true);
1248
 
1249
+ /**
1250
+ * Action that is called after an event has been logged
1251
+ *
1252
+ * @since 2.5.1
1253
+ *
1254
+ * @param array $context Array with all context data to store. Modify and return this.
1255
+ * @param array $data Array with data used for parent row.
1256
+ * @param array $this Reference to this logger instance
1257
+ */
1258
+ do_action( "simple_history/log/inserted", $context, $data_parent_row, $this );
1259
+
1260
  // Return $this so we can chain methods
1261
  return $this;
1262
 
loggers/SimpleUserLogger.php CHANGED
@@ -29,7 +29,7 @@ class SimpleUserLogger extends SimpleLogger {
29
  'user_updated_profile' => __("Edited the profile for user {edited_user_login} ({edited_user_email})", "simple-history"),
30
  'user_created' => __("Created user {created_user_login} ({created_user_email}) with role {created_user_role}", "simple-history"),
31
  'user_deleted' => __("Deleted user {deleted_user_login} ({deleted_user_email})", "simple-history"),
32
- "user_password_reseted" => __("Reseted their password", "simple-history"),
33
  "user_requested_password_reset_link" => __("Requested a password reset link for user with login '{user_login}' and email '{user_email}'", "simple-history"),
34
 
35
  /*
@@ -306,15 +306,15 @@ class SimpleUserLogger extends SimpleLogger {
306
  $output = parent::getLogRowPlainTextOutput($row);
307
  $current_user_id = get_current_user_id();
308
 
309
- if ("user_updated_profile" == $context["_message_key"]) {
310
 
311
- $wp_user = get_user_by("id", $context["edited_user_id"]);
312
 
313
  // If edited_user_id and _user_id is the same then a user edited their own profile
314
  // Note: it's not the same thing as the currently logged in user (but.. it can be!)
315
- if ($context["edited_user_id"] === $context["_user_id"]) {
316
 
317
- if ($wp_user) {
318
 
319
  $context["edit_profile_link"] = get_edit_user_link($wp_user->ID);
320
 
29
  'user_updated_profile' => __("Edited the profile for user {edited_user_login} ({edited_user_email})", "simple-history"),
30
  'user_created' => __("Created user {created_user_login} ({created_user_email}) with role {created_user_role}", "simple-history"),
31
  'user_deleted' => __("Deleted user {deleted_user_login} ({deleted_user_email})", "simple-history"),
32
+ "user_password_reseted" => __("Reset their password", "simple-history"),
33
  "user_requested_password_reset_link" => __("Requested a password reset link for user with login '{user_login}' and email '{user_email}'", "simple-history"),
34
 
35
  /*
306
  $output = parent::getLogRowPlainTextOutput($row);
307
  $current_user_id = get_current_user_id();
308
 
309
+ if ( "user_updated_profile" == $context["_message_key"] ) {
310
 
311
+ $wp_user = get_user_by( "id", $context["edited_user_id"] );
312
 
313
  // If edited_user_id and _user_id is the same then a user edited their own profile
314
  // Note: it's not the same thing as the currently logged in user (but.. it can be!)
315
+ if ( ! empty( $context["_user_id"] ) && $context["edited_user_id"] === $context["_user_id"] ) {
316
 
317
+ if ( $wp_user ) {
318
 
319
  $context["edit_profile_link"] = get_edit_user_link($wp_user->ID);
320
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 3.6.0
6
  Tested up to: 4.4
7
- Stable tag: 2.5
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -20,6 +20,8 @@ Out of the box Simple History has support for:
20
  see who added, updated or deleted a post or page
21
  * **Attachments**<br>
22
  see who added, updated or deleted an attachment
 
 
23
  * **Comments**<br>
24
  see who edited, approved or removed a comment
25
  * **Widgets**<br>
@@ -125,7 +127,7 @@ https://github.com/bonny/WordPress-Simple-History
125
  are of type post and pages and media (i.e. images & other uploads), and only events
126
  initiated by a specific user.
127
 
128
- 2. The __Post Quick Diff__ feature will make it quick and easy for a user of a site to see what updates other users are have done to posts and pages.
129
 
130
  3. Events with different severity – Simple History uses the log levels specified in the PHP PSR-3 standard.
131
 
@@ -140,6 +142,16 @@ initiated by a specific user.
140
 
141
  ## Changelog
142
 
 
 
 
 
 
 
 
 
 
 
143
  = 2.5 (December 2015) =
144
 
145
  - Added: Category edits are now logged, so now you can see terms, categories and taxonomies that are added, changed, and deleted. Fixes for example https://wordpress.org/support/topic/view-changes-to-categories and https://twitter.com/hmarafi/status/655994402037362688.
4
  Tags: history, log, changes, changelog, audit, trail, pages, attachments, users, cms, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 3.6.0
6
  Tested up to: 4.4
7
+ Stable tag: 2.5.1
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
20
  see who added, updated or deleted a post or page
21
  * **Attachments**<br>
22
  see who added, updated or deleted an attachment
23
+ * **Taxonomies (Custom taxonomies, categories, tags)**<br>
24
+ see who added, updated or deleted an taxonomy
25
  * **Comments**<br>
26
  see who edited, approved or removed a comment
27
  * **Widgets**<br>
127
  are of type post and pages and media (i.e. images & other uploads), and only events
128
  initiated by a specific user.
129
 
130
+ 2. The __Post Quick Diff__ feature will make it quick and easy for a user of a site to see what updates other users have done to posts and pages.
131
 
132
  3. Events with different severity – Simple History uses the log levels specified in the PHP PSR-3 standard.
133
 
142
 
143
  ## Changelog
144
 
145
+ = 2.5.1 (December 2015) =
146
+
147
+ - Fixed: No longer assume that the ajaxurl don't already contains query params. Should fix problems with third party plugins like [WPML](https://wpml.org/).
148
+ - Fixed: Notice if context key did not exist. Should fix https://github.com/bonny/WordPress-Simple-History/issues/100.
149
+ - Fixed: Name and title on dashboard and settings page were not translateable. Fixes https://wordpress.org/support/topic/dashboard-max-length-of-content.
150
+ - Fixed: Typo when user resets password.
151
+ - Added: Filter `simple_history/row_header_date_output`.
152
+ - Added: Filter `simple_history/log/inserted`.
153
+ - Added: Filter `simple_history/row_header_date_output`.
154
+
155
  = 2.5 (December 2015) =
156
 
157
  - Added: Category edits are now logged, so now you can see terms, categories and taxonomies that are added, changed, and deleted. Fixes for example https://wordpress.org/support/topic/view-changes-to-categories and https://twitter.com/hmarafi/status/655994402037362688.