Simple History - Version 1.3.11

Version Description

  • Don't use deprecated function get_commentdata(). Fixes https://wordpress.org/support/topic/get_commentdata-function-is-deprecated.
  • Don't use mysql_query() directly. Fixes https://wordpress.org/support/topic/deprecated-mysql-warning.
  • Beta testers wanted! I'm working on the next version of Simple History and now I need some beta testers. If you want to try out the shiny new and cool version please download the v2 branch over at GitHub. Thanks!
Download this release

Release Info

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

Code changes from version 1.3.10 to 1.3.11

Files changed (3) hide show
  1. index.php +6 -6
  2. log-tests.php +0 -180
  3. readme.txt +6 -1
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
6
- Version: 1.3.10
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -27,7 +27,7 @@ License: GPL2
27
 
28
  load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
 
30
- define( "SIMPLE_HISTORY_VERSION", "1.3.10");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
 
33
  // Find the plugin directory URL
@@ -258,7 +258,7 @@ define("SIMPLE_HISTORY_URL", $plugin_dir_url);
258
 
259
  // Add column for action description in non-translateable free text
260
  $sql = "ALTER TABLE {$table_name} ADD COLUMN action_description longtext";
261
- mysql_query($sql);
262
 
263
  simple_history_add("action=" . 'upgraded its database' . "&object_type=plugin&object_name=" . SIMPLE_HISTORY_NAME . "&description=Database version is now version 2");
264
  update_option("simple_history_db_version", 2);
@@ -782,7 +782,7 @@ function simple_history_deactivated_plugin($plugin_name) {
782
 
783
  function simple_history_edit_comment($comment_id) {
784
 
785
- $comment_data = get_commentdata($comment_id, 0, true);
786
  $comment_post_ID = $comment_data["comment_post_ID"];
787
  $post = get_post($comment_post_ID);
788
  $post_title = get_the_title($comment_post_ID);
@@ -798,7 +798,7 @@ function simple_history_edit_comment($comment_id) {
798
 
799
  function simple_history_delete_comment($comment_id) {
800
 
801
- $comment_data = get_commentdata($comment_id, 0, true);
802
  $comment_post_ID = $comment_data["comment_post_ID"];
803
  $post = get_post($comment_post_ID);
804
  $post_title = get_the_title($comment_post_ID);
@@ -815,7 +815,7 @@ function simple_history_delete_comment($comment_id) {
815
  function simple_history_set_comment_status($comment_id, $new_status) {
816
  #echo "<br>new status: $new_status<br>"; // 0
817
  // $new_status hold (unapproved), approve, spam, trash
818
- $comment_data = get_commentdata($comment_id, 0, true);
819
  $comment_post_ID = $comment_data["comment_post_ID"];
820
  $post = get_post($comment_post_ID);
821
  $post_title = get_the_title($comment_post_ID);
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log/history/audit log/version history of the changes made by users in WordPress.
6
+ Version: 1.3.11
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
27
 
28
  load_plugin_textdomain('simple-history', false, "/simple-history/languages");
29
 
30
+ define( "SIMPLE_HISTORY_VERSION", "1.3.11");
31
  define( "SIMPLE_HISTORY_NAME", "Simple History");
32
 
33
  // Find the plugin directory URL
258
 
259
  // Add column for action description in non-translateable free text
260
  $sql = "ALTER TABLE {$table_name} ADD COLUMN action_description longtext";
261
+ $wpdb->query($sql);
262
 
263
  simple_history_add("action=" . 'upgraded its database' . "&object_type=plugin&object_name=" . SIMPLE_HISTORY_NAME . "&description=Database version is now version 2");
264
  update_option("simple_history_db_version", 2);
782
 
783
  function simple_history_edit_comment($comment_id) {
784
 
785
+ $comment_data = get_comment($comment_id, ARRAY_A);
786
  $comment_post_ID = $comment_data["comment_post_ID"];
787
  $post = get_post($comment_post_ID);
788
  $post_title = get_the_title($comment_post_ID);
798
 
799
  function simple_history_delete_comment($comment_id) {
800
 
801
+ $comment_data = get_comment($comment_id, ARRAY_A);
802
  $comment_post_ID = $comment_data["comment_post_ID"];
803
  $post = get_post($comment_post_ID);
804
  $post_title = get_the_title($comment_post_ID);
815
  function simple_history_set_comment_status($comment_id, $new_status) {
816
  #echo "<br>new status: $new_status<br>"; // 0
817
  // $new_status hold (unapproved), approve, spam, trash
818
+ $comment_data = get_comment($comment_id, ARRAY_A);
819
  $comment_post_ID = $comment_data["comment_post_ID"];
820
  $post = get_post($comment_post_ID);
821
  $post_title = get_the_title($comment_post_ID);
log-tests.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
-
3
- add_action("init", function() {
4
-
5
- register_post_type("texts", array(
6
- "show_ui" => true
7
- ));
8
-
9
- register_post_type("products", array(
10
- "labels" => array(
11
- "name" => "Products",
12
- "singular_name" => "Product"
13
- ),
14
- "public" => true
15
- ));
16
-
17
- // Example from the codex
18
- $labels = array(
19
- 'name' => _x( 'Books', 'post type general name', 'your-plugin-textdomain' ),
20
- 'singular_name' => _x( 'Book', 'post type singular name', 'your-plugin-textdomain' ),
21
- 'menu_name' => _x( 'Books', 'admin menu', 'your-plugin-textdomain' ),
22
- 'name_admin_bar' => _x( 'Book', 'add new on admin bar', 'your-plugin-textdomain' ),
23
- 'add_new' => _x( 'Add New', 'book', 'your-plugin-textdomain' ),
24
- 'add_new_item' => __( 'Add New Book', 'your-plugin-textdomain' ),
25
- 'new_item' => __( 'New Book', 'your-plugin-textdomain' ),
26
- 'edit_item' => __( 'Edit Book', 'your-plugin-textdomain' ),
27
- 'view_item' => __( 'View Book', 'your-plugin-textdomain' ),
28
- 'all_items' => __( 'All Books', 'your-plugin-textdomain' ),
29
- 'search_items' => __( 'Search Books', 'your-plugin-textdomain' ),
30
- 'parent_item_colon' => __( 'Parent Books:', 'your-plugin-textdomain' ),
31
- 'not_found' => __( 'No books found.', 'your-plugin-textdomain' ),
32
- 'not_found_in_trash' => __( 'No books found in Trash.', 'your-plugin-textdomain' ),
33
- );
34
-
35
- $args = array(
36
- 'labels' => $labels,
37
- 'public' => true,
38
- 'publicly_queryable' => true,
39
- 'show_ui' => true,
40
- 'show_in_menu' => true,
41
- 'query_var' => true,
42
- 'rewrite' => array( 'slug' => 'book' ),
43
- 'capability_type' => 'post',
44
- 'has_archive' => true,
45
- 'hierarchical' => false,
46
- 'menu_position' => null,
47
- 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
48
- );
49
-
50
- register_post_type( 'book', $args );
51
-
52
- });
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
- // Log testing beloe
63
- return;
64
- //*
65
-
66
- /*
67
- SimpleLogger()->info("This is a message sent to the log");
68
-
69
- // Second log entry with same info will make these two become an occasionGroup,
70
- // collapsing their entries into one expandable log item
71
- SimpleLogger()->info("This is a message sent to the log");
72
-
73
- // Log entries can be of different severity
74
- SimpleLogger()->info("User admin edited page 'About our company'");
75
- SimpleLogger()->warning("User 'Jessie' deleted user 'Kim'");
76
- SimpleLogger()->debug("Ok, cron job is running!");
77
- */
78
-
79
- // Log entries can have placeholders and context
80
- // This makes log entried translatable and filterable
81
- for ($i = 0; $i < rand(1, 50); $i++) {
82
- SimpleLogger()->notice(
83
- "User {username} edited page {pagename}",
84
- array(
85
- "username" => "bonnyerden",
86
- "pagename" => "My test page",
87
- "_initiator" => SimpleLoggerLogInitiators::WP_USER,
88
- "_user_id" => rand(1,20),
89
- "_user_login" => "loginname" . rand(1,20),
90
- "_user_email" => "user" . rand(1,20) . "@example.com"
91
- )
92
- );
93
- }
94
- #return;
95
-
96
- // Log entried can have custom occasionsID
97
- // This will group items together and a log entry will only be shown once
98
- // in the log overview
99
- for ($i = 0; $i < rand(1, 50); $i++) {
100
- SimpleLogger()->notice("User {username} edited page {pagename}", array(
101
- "username" => "admin",
102
- "pagename" => "My test page",
103
- "_occasionsID" => "username:1,postID:24884,action:edited"
104
- ));
105
- }
106
-
107
- // Add more data to context array. Data can be used later on to show detailed info about a log entry.
108
- SimpleLogger()->notice("Edited product {pagename}", array(
109
- "pagename" => "We are hiring!",
110
- "_postType" => "product",
111
- "_userID" => 1,
112
- "_userLogin" => "jessie",
113
- "_userEmail" => "jessie@example.com",
114
- "_occasionsID" => "username:1,postID:24885,action:edited"
115
- ));
116
-
117
- for ($i = 0; $i < rand(50,1000); $i++) {
118
- SimpleLogger()->info('User "{user_login}" failed to login because they did not enter a correct password', array(
119
- "user_login" => "admin",
120
- "_userID" => null
121
- ));
122
- }
123
-
124
- // Test logging both inside and outside init-hook
125
- // To make sure it works regardless of wp_get_current_user is avaialble or not
126
- SimpleLogger()->warning("This is a warning log entry before init");
127
- SimpleLogger()->error("This is an error log entry before init");
128
- SimpleLogger()->debug("This is a debug log entry before init");
129
-
130
- add_action("init", function() {
131
-
132
- SimpleLogger()->warning("This is a warning log entry (after init)");
133
- SimpleLogger()->error("This is an error log entry (after init)");
134
- SimpleLogger()->debug("This is a debug log entry (after init)");
135
-
136
-
137
- SimpleLogger()->info(
138
- "WordPress updated itself from version {from_version} to {to_version}",
139
- array(
140
- "from_version" => "3.8",
141
- "to_version" => "3.8.1",
142
- "_initiator" => SimpleLoggerLogInitiators::WORDPRESS
143
- )
144
- );
145
-
146
- SimpleLogger()->info(
147
- "Plugin {plugin_name} was updated from version {plugin_from_version} to version {plugin_to_version}",
148
- array(
149
- "plugin_name" => "CMS Tree Page View",
150
- "plugin_from_version" => "4.0",
151
- "plugin_to_version" => "4.2",
152
- "_initiator" => SimpleLoggerLogInitiators::WORDPRESS
153
- )
154
- );
155
-
156
- SimpleLogger()->info(
157
- "Updated plugin {plugin_name} from version {plugin_from_version} to version {plugin_to_version}",
158
- array(
159
- "plugin_name" => "Simple Fields",
160
- "plugin_from_version" => "1.3.7",
161
- "plugin_to_version" => "1.3.8",
162
- "_initiator" => SimpleLoggerLogInitiators::WP_USER
163
- )
164
- );
165
-
166
- SimpleLogger()->info(
167
- "Updated plugin {plugin_name} from version {plugin_from_version} to version {plugin_to_version}",
168
- array(
169
- "plugin_name" => "Ninja Forms",
170
- "plugin_from_version" => "1.1",
171
- "plugin_to_version" => "1.1.2",
172
- "_initiator" => SimpleLoggerLogInitiators::WP_USER
173
- )
174
- );
175
-
176
- });
177
-
178
-
179
-
180
- //*/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, trail, stream, pages, attachments, users, cms, dashboard, admin, syslog, activity
5
  Requires at least: 3.8.0
6
  Tested up to: 4.0
7
- Stable tag: 1.3.10
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
@@ -175,6 +175,11 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
175
 
176
  == Changelog ==
177
 
 
 
 
 
 
178
  = 1.3.10 =
179
  - Fix: correct usage of "its"
180
  - Fix: removed serif font in log. Fixes https://wordpress.org/support/topic/two-irritations-and-pleas-for-change.
4
  Tags: history, log, changes, changelog, audit, trail, stream, pages, attachments, users, cms, dashboard, admin, syslog, activity
5
  Requires at least: 3.8.0
6
  Tested up to: 4.0
7
+ Stable tag: 1.3.11
8
 
9
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
10
 
175
 
176
  == Changelog ==
177
 
178
+ = 1.3.11 =
179
+ - Don't use deprecated function get_commentdata(). Fixes https://wordpress.org/support/topic/get_commentdata-function-is-deprecated.
180
+ - Don't use mysql_query() directly. Fixes https://wordpress.org/support/topic/deprecated-mysql-warning.
181
+ - Beta testers wanted! I'm working on the next version of Simple History and now I need some beta testers. If you want to try out the shiny new and cool version please download the [v2 branch](https://github.com/bonny/WordPress-Simple-History/tree/v2) over at GitHub. Thanks!
182
+
183
  = 1.3.10 =
184
  - Fix: correct usage of "its"
185
  - Fix: removed serif font in log. Fixes https://wordpress.org/support/topic/two-irritations-and-pleas-for-change.