Simple History - Version 0.3.2

Version Description

  • fixed some php notice messages + some other small things I don't remember..
Download this release

Release Info

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

Code changes from version 0.3.1 to 0.3.2

Files changed (2) hide show
  1. index.php +47 -25
  2. readme.txt +7 -3
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 of the changes made by users in WordPress.
6
- Version: 0.3.1
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
@@ -25,7 +25,7 @@ License: GPL2
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
- define( "SIMPLE_HISTORY_VERSION", "0.3.1");
29
  define( "SIMPLE_HISTORY_NAME", "Simple History");
30
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
31
 
@@ -44,7 +44,10 @@ function simple_history_ajax() {
44
  $user = $_POST["user"];
45
  if ($user == "By all users") { $user = ""; }
46
 
47
- $page = (int) $_POST["page"];
 
 
 
48
 
49
  $args = array(
50
  "is_ajax" => true,
@@ -231,7 +234,7 @@ function simple_history_init() {
231
 
232
  // check for RSS
233
  // don't know if this is the right way to do this, but it seems to work!
234
- if ($_GET["simple_history_get_rss"]) {
235
 
236
  $rss_secret_option = get_option("simple_history_rss_secret");
237
  $rss_secret_get = $_GET["rss_secret"];
@@ -747,7 +750,11 @@ function simple_history_print_nav() {
747
  $tableprefix = $wpdb->prefix;
748
 
749
  // fetch all types that are in the log
750
- $simple_history_type_to_show = $_GET["simple_history_type_to_show"];
 
 
 
 
751
  $sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype";
752
  $arr_types = $wpdb->get_results($sql);
753
  #echo "<p>View:</p>";
@@ -800,15 +807,25 @@ function simple_history_print_nav() {
800
  if (!empty($arr_users)) {
801
  foreach ($arr_users as $user_id => $one_user) {
802
  $user = get_user_by("id", $user_id);
803
- $arr_users[$user_id]["user_login"] = $user->user_login;
804
- $arr_users[$user_id]["user_nicename"] = $user->user_nicename;
805
- $arr_users[$user_id]["first_name"] = $user->first_name;
806
- $arr_users[$user_id]["last_name"] = $user->last_name;
 
 
 
 
 
 
807
  }
808
  }
809
 
810
  if ($arr_users) {
811
- $simple_history_user_to_show = $_GET["simple_history_user_to_show"];
 
 
 
 
812
  $str_users = "";
813
  $str_users .= "<ul class='simple-history-filter simple-history-filter-user'>";
814
  $css = "";
@@ -892,7 +909,8 @@ function simple_history_get_items_array($args) {
892
  $prev_row = null;
893
  foreach ($rows as $one_row) {
894
  if (
895
- $one_row->action == $prev_row->action
 
896
  && $one_row->object_type == $prev_row->object_type
897
  && $one_row->object_type == $prev_row->object_type
898
  && $one_row->object_subtype == $prev_row->object_subtype
@@ -1021,14 +1039,16 @@ function simple_history_print_history($args = null) {
1021
  $who .= "<a href='$user_link'>";
1022
  $who .= $user->user_nicename;
1023
  $who .= "</a>";
1024
- if ($user->first_name || $user->last_name) {
1025
- $who .= " (";
1026
- if ($user->first_name && $user->last_name) {
1027
- $who .= $user->first_name . " " . $user->last_name;
1028
- } else {
1029
- $who .= $user->first_name . $user->last_name; // just one of them, no space necessary
 
 
 
1030
  }
1031
- $who .= ")";
1032
  }
1033
  } else {
1034
  $who .= "&lt;Unknown or deleted user&gt;";
@@ -1123,14 +1143,16 @@ function simple_history_print_history($args = null) {
1123
  $user_out .= " <a href='$user_link'>";
1124
  $user_out .= $user->user_nicename;
1125
  $user_out .= "</a>";
1126
- if ($user->first_name || $user->last_name) {
1127
- $user_out .= " (";
1128
- if ($user->first_name && $user->last_name) {
1129
- $user_out .= $user->first_name . " " . $user->last_name;
1130
- } else {
1131
- $user_out .= $user->first_name . $user->last_name; // just one of them, no space necessary
 
 
 
1132
  }
1133
- $user_out .= ")";
1134
  }
1135
  $user_out .= "</span>";
1136
  } else {
3
  Plugin Name: Simple History
4
  Plugin URI: http://eskapism.se/code-playground/simple-history/
5
  Description: Get a log of the changes made by users in WordPress.
6
+ Version: 0.3.2
7
  Author: Pär Thernström
8
  Author URI: http://eskapism.se/
9
  License: GPL2
25
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26
  */
27
 
28
+ define( "SIMPLE_HISTORY_VERSION", "0.3.2");
29
  define( "SIMPLE_HISTORY_NAME", "Simple History");
30
  define( "SIMPLE_HISTORY_URL", WP_PLUGIN_URL . '/simple-history/');
31
 
44
  $user = $_POST["user"];
45
  if ($user == "By all users") { $user = ""; }
46
 
47
+ $page = 0;
48
+ if (isset($_POST["page"])) {
49
+ $page = (int) $_POST["page"];
50
+ }
51
 
52
  $args = array(
53
  "is_ajax" => true,
234
 
235
  // check for RSS
236
  // don't know if this is the right way to do this, but it seems to work!
237
+ if (isset($_GET["simple_history_get_rss"])) {
238
 
239
  $rss_secret_option = get_option("simple_history_rss_secret");
240
  $rss_secret_get = $_GET["rss_secret"];
750
  $tableprefix = $wpdb->prefix;
751
 
752
  // fetch all types that are in the log
753
+ if (isset($_GET["simple_history_type_to_show"])) {
754
+ $simple_history_type_to_show = $_GET["simple_history_type_to_show"];
755
+ } else {
756
+ $simple_history_type_to_show = "";
757
+ }
758
  $sql = "SELECT DISTINCT object_type, object_subtype FROM {$tableprefix}simple_history ORDER BY object_type, object_subtype";
759
  $arr_types = $wpdb->get_results($sql);
760
  #echo "<p>View:</p>";
807
  if (!empty($arr_users)) {
808
  foreach ($arr_users as $user_id => $one_user) {
809
  $user = get_user_by("id", $user_id);
810
+ if ($user) {
811
+ $arr_users[$user_id]["user_login"] = $user->user_login;
812
+ $arr_users[$user_id]["user_nicename"] = $user->user_nicename;
813
+ if (isset($user->first_name)) {
814
+ $arr_users[$user_id]["first_name"] = $user->first_name;
815
+ }
816
+ if (isset($user->last_name)) {
817
+ $arr_users[$user_id]["last_name"] = $user->last_name;
818
+ }
819
+ }
820
  }
821
  }
822
 
823
  if ($arr_users) {
824
+ if (isset($_GET["simple_history_user_to_show"])) {
825
+ $simple_history_user_to_show = $_GET["simple_history_user_to_show"];
826
+ } else {
827
+ $simple_history_user_to_show = "";
828
+ }
829
  $str_users = "";
830
  $str_users .= "<ul class='simple-history-filter simple-history-filter-user'>";
831
  $css = "";
909
  $prev_row = null;
910
  foreach ($rows as $one_row) {
911
  if (
912
+ $prev_row
913
+ && $one_row->action == $prev_row->action
914
  && $one_row->object_type == $prev_row->object_type
915
  && $one_row->object_type == $prev_row->object_type
916
  && $one_row->object_subtype == $prev_row->object_subtype
1039
  $who .= "<a href='$user_link'>";
1040
  $who .= $user->user_nicename;
1041
  $who .= "</a>";
1042
+ if (isset($user->first_name) && isset($user->last_name)) {
1043
+ if ($user->first_name || $user->last_name) {
1044
+ $who .= " (";
1045
+ if ($user->first_name && $user->last_name) {
1046
+ $who .= $user->first_name . " " . $user->last_name;
1047
+ } else {
1048
+ $who .= $user->first_name . $user->last_name; // just one of them, no space necessary
1049
+ }
1050
+ $who .= ")";
1051
  }
 
1052
  }
1053
  } else {
1054
  $who .= "&lt;Unknown or deleted user&gt;";
1143
  $user_out .= " <a href='$user_link'>";
1144
  $user_out .= $user->user_nicename;
1145
  $user_out .= "</a>";
1146
+ if (isset($user->first_name) && isset($user->last_name)) {
1147
+ if ($user->first_name || $user->last_name) {
1148
+ $user_out .= " (";
1149
+ if ($user->first_name && $user->last_name) {
1150
+ $user_out .= $user->first_name . " " . $user->last_name;
1151
+ } else {
1152
+ $user_out .= $user->first_name . $user->last_name; // just one of them, no space necessary
1153
+ }
1154
+ $user_out .= ")";
1155
  }
 
1156
  }
1157
  $user_out .= "</span>";
1158
  } else {
readme.txt CHANGED
@@ -30,14 +30,15 @@ the new press release and created an article for it. Great! Now I don't have to
30
 
31
  Or for debug purposes:
32
  _"The site feels very slow since yesterday. Has anyone done anything special? ... Ah, Steven activated 'naughy-plugin-x',
33
- that must be it."
34
-
35
 
36
  #### See it in action
37
  See the plugin in action with this short screencast:
38
  [youtube http://www.youtube.com/watch?v=4cu4kooJBzs]
39
 
40
- ![Screenshot of Simple History](http://eskapism.se/wordpress/wp-content/uploads/2010/07/simple-history-dashboard-screenshot.png "Screenshot of Simple History")
 
 
41
 
42
  == Installation ==
43
 
@@ -61,6 +62,9 @@ to only use the secret RSS feed to keep track of the changes on you web site/Wor
61
 
62
  == Changelog ==
63
 
 
 
 
64
  = 0.3.1 =
65
  - forgot to escape html for posts
66
  - reduced memory usage... I think/hope...
30
 
31
  Or for debug purposes:
32
  _"The site feels very slow since yesterday. Has anyone done anything special? ... Ah, Steven activated 'naughy-plugin-x',
33
+ that must be it."_
 
34
 
35
  #### See it in action
36
  See the plugin in action with this short screencast:
37
  [youtube http://www.youtube.com/watch?v=4cu4kooJBzs]
38
 
39
+ #### Donation and more plugins
40
+ * If you like this plugin don't forget to [donate to support further development](http://eskapism.se/sida/donate/).
41
+ * Check out some [more plugins](http://wordpress.org/extend/plugins/profile/eskapism) by the same author.
42
 
43
  == Installation ==
44
 
62
 
63
  == Changelog ==
64
 
65
+ = 0.3.2 =
66
+ - fixed some php notice messages + some other small things I don't remember..
67
+
68
  = 0.3.1 =
69
  - forgot to escape html for posts
70
  - reduced memory usage... I think/hope...