Postie - Version 1.9.9

Version Description

(2017-10-30) = * Fix: remove assumption that there is a user with the administrator role

Download this release

Release Info

Developer WayneAllen
Plugin Icon 128x128 Postie
Version 1.9.9
Comparing to
See all releases

Code changes from version 1.9.8 to 1.9.9

config_form.php CHANGED
@@ -46,7 +46,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-admin.class.php")
46
  break;
47
  }
48
  }
49
- global $wpdb, $wp_roles;
50
 
51
  $pconfig = new PostieConfig();
52
  $config = $pconfig->config_read();
46
  break;
47
  }
48
  }
49
+ global $wpdb, $wp_roles; //don't remove - used in included files
50
 
51
  $pconfig = new PostieConfig();
52
  $config = $pconfig->config_read();
config_form_user.php CHANGED
@@ -11,7 +11,7 @@
11
  foreach ($wp_roles->role_names as $roleId => $name) {
12
  $name = translate_user_role($name);
13
  $role = $wp_roles->get_role($roleId);
14
- if ($roleId != "administrator") {
15
  ?>
16
  <tr>
17
  <td>
11
  foreach ($wp_roles->role_names as $roleId => $name) {
12
  $name = translate_user_role($name);
13
  $role = $wp_roles->get_role($roleId);
14
+ if ($roleId != 'administrator') {
15
  ?>
16
  <tr>
17
  <td>
docs/Changes.txt CHANGED
@@ -35,6 +35,9 @@ All script, style and body tags are stripped from html emails.
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
 
 
 
38
  = 1.9.8 (2017-10-23) =
39
  * Fix: check that global is initialized before using
40
 
35
  Attachments are now processed in the order they were attached.
36
 
37
  == CHANGELOG ==
38
+ = 1.9.9 (2017-10-30) =
39
+ * Fix: remove assumption that there is a user with the administrator role
40
+
41
  = 1.9.8 (2017-10-23) =
42
  * Fix: check that global is initialized before using
43
 
docs/Postie.txt CHANGED
@@ -7,7 +7,7 @@ Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.8.2
10
- Stable tag: 1.9.8
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.8.2
10
+ Stable tag: 1.9.9
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
postie-config.class.php CHANGED
@@ -83,21 +83,23 @@ class PostieConfig {
83
  global $wp_roles;
84
  if (is_object($wp_roles)) {
85
  $admin = $wp_roles->get_role('administrator');
86
- $admin->add_cap('config_postie');
87
- $admin->add_cap('post_via_postie');
 
88
 
89
- if (!is_array($role_access)) {
90
- $role_access = array();
91
- }
92
- foreach ($wp_roles->role_names as $roleId => $name) {
93
- $role = $wp_roles->get_role($roleId);
94
- if ($roleId != 'administrator') {
95
- if (array_key_exists($roleId, $role_access)) {
96
- $role->add_cap('post_via_postie');
97
- //DebugEcho("added $roleId");
98
- } else {
99
- $role->remove_cap('post_via_postie');
100
- //DebugEcho("removed $roleId");
 
101
  }
102
  }
103
  }
83
  global $wp_roles;
84
  if (is_object($wp_roles)) {
85
  $admin = $wp_roles->get_role('administrator');
86
+ if (!empty($admin)) {
87
+ $admin->add_cap('config_postie');
88
+ $admin->add_cap('post_via_postie');
89
 
90
+ if (!is_array($role_access)) {
91
+ $role_access = array();
92
+ }
93
+ foreach ($wp_roles->role_names as $roleId => $name) {
94
+ $role = $wp_roles->get_role($roleId);
95
+ if ($roleId != 'administrator') {
96
+ if (array_key_exists($roleId, $role_access)) {
97
+ $role->add_cap('post_via_postie');
98
+ //DebugEcho("added $roleId");
99
+ } else {
100
+ $role->remove_cap('post_via_postie');
101
+ //DebugEcho("removed $roleId");
102
+ }
103
  }
104
  }
105
  }
postie.class.php CHANGED
@@ -795,7 +795,7 @@ class Postie {
795
 
796
  $content = filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $config);
797
 
798
- if (trim($subject) == "") {
799
  $subject = $config['default_title'];
800
  DebugEcho("post parsing subject is blank using: " . $config['default_title']);
801
  }
@@ -820,7 +820,7 @@ class Postie {
820
  'ID' => $id,
821
  'post_status' => $post_status
822
  );
823
-
824
  //need to set post format differently since it is a type of taxonomy
825
  wp_set_post_terms($post_id, $post_type_format['post_format'], 'post_format');
826
 
@@ -1184,19 +1184,21 @@ class Postie {
1184
  $tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost', 'post_status' => 'draft');
1185
  $post_id = wp_insert_post($tmpPost, true);
1186
  if (!is_wp_error($post_id)) {
1187
- DebugEcho("PostEmail: tmp post id is $post_id");
1188
 
1189
  $is_reply = false;
1190
 
1191
- DebugEcho("PostEmail: pre postie_post_pre");
1192
  $mimeDecodedEmail = apply_filters('postie_post_pre', $mimeDecodedEmail);
1193
 
1194
  $details = $this->create_post($poster, $mimeDecodedEmail, $post_id, $is_reply, $config);
1195
 
 
 
1196
  $details = apply_filters('postie_post', $details);
1197
  $details = apply_filters('postie_post_before', $details, $mimeDecodedEmail['headers']);
1198
 
1199
- DebugEcho("PostEmail: Post postie_post_before filter");
1200
  DebugDump($details);
1201
 
1202
  if (empty($details)) {
@@ -1205,7 +1207,7 @@ class Postie {
1205
  // then it should be removed
1206
  if (!$is_reply) {
1207
  wp_delete_post($post_id);
1208
- EchoError("postie_post filter cleared the post, not saving.");
1209
  }
1210
  } else {
1211
  $postid = $this->save_post($details, $is_reply);
@@ -1224,18 +1226,18 @@ class Postie {
1224
 
1225
  if ($this->is_debugmode()) {
1226
  $post = get_post($post_id);
1227
- DebugEcho("PostEmail: resulting post");
1228
  DebugDump($post);
1229
  }
1230
  }
1231
  } else {
1232
- EchoError("PostEmail: wp_insert_post failed: " . $post_id->get_error_message());
1233
  DebugDump($post_id->get_error_messages());
1234
  DebugDump($post_id->get_error_data());
1235
- $this->notify_error("PostEmail wp_insert_post failed creating placeholder", $post_id->get_error_message());
1236
  }
1237
  $this->disable_revisions(true);
1238
- DebugEcho("Done");
1239
  }
1240
 
1241
  /**
795
 
796
  $content = filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $config);
797
 
798
+ if (trim($subject) == '') {
799
  $subject = $config['default_title'];
800
  DebugEcho("post parsing subject is blank using: " . $config['default_title']);
801
  }
820
  'ID' => $id,
821
  'post_status' => $post_status
822
  );
823
+
824
  //need to set post format differently since it is a type of taxonomy
825
  wp_set_post_terms($post_id, $post_type_format['post_format'], 'post_format');
826
 
1184
  $tmpPost = array('post_title' => 'tmptitle', 'post_content' => 'tmpPost', 'post_status' => 'draft');
1185
  $post_id = wp_insert_post($tmpPost, true);
1186
  if (!is_wp_error($post_id)) {
1187
+ DebugEcho("post_email: tmp post id is $post_id");
1188
 
1189
  $is_reply = false;
1190
 
1191
+ DebugEcho("post_email: pre postie_post_pre");
1192
  $mimeDecodedEmail = apply_filters('postie_post_pre', $mimeDecodedEmail);
1193
 
1194
  $details = $this->create_post($poster, $mimeDecodedEmail, $post_id, $is_reply, $config);
1195
 
1196
+ DebugEcho("post_email: Before postie_post_before filter");
1197
+
1198
  $details = apply_filters('postie_post', $details);
1199
  $details = apply_filters('postie_post_before', $details, $mimeDecodedEmail['headers']);
1200
 
1201
+ DebugEcho("post_email: After postie_post_before filter");
1202
  DebugDump($details);
1203
 
1204
  if (empty($details)) {
1207
  // then it should be removed
1208
  if (!$is_reply) {
1209
  wp_delete_post($post_id);
1210
+ DebugEcho("postie_post filter cleared the post, not saving.");
1211
  }
1212
  } else {
1213
  $postid = $this->save_post($details, $is_reply);
1226
 
1227
  if ($this->is_debugmode()) {
1228
  $post = get_post($post_id);
1229
+ DebugEcho("post_email: resulting post");
1230
  DebugDump($post);
1231
  }
1232
  }
1233
  } else {
1234
+ EchoError("post_email: wp_insert_post failed: " . $post_id->get_error_message());
1235
  DebugDump($post_id->get_error_messages());
1236
  DebugDump($post_id->get_error_data());
1237
+ $this->notify_error("post_email: wp_insert_post failed creating placeholder", $post_id->get_error_message());
1238
  }
1239
  $this->disable_revisions(true);
1240
+ DebugEcho("post_email: Done");
1241
  }
1242
 
1243
  /**
postie.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
7
- Version: 1.9.8
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
@@ -28,14 +28,14 @@
28
  */
29
 
30
  /*
31
- $Id: postie.php 1751535 2017-10-23 23:23:41Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
- define('POSTIE_VERSION', '1.9.8');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
4
  Plugin Name: Postie
5
  Plugin URI: http://PostiePlugin.com/
6
  Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
7
+ Version: 1.9.9
8
  Author: Wayne Allen
9
  Author URI: http://PostiePlugin.com/
10
  License: GPL3
28
  */
29
 
30
  /*
31
+ $Id: postie.php 1755522 2017-10-30 21:44:02Z WayneAllen $
32
  */
33
 
34
  if (!defined('WPINC')) {
35
  die; // Exit if accessed directly
36
  }
37
 
38
+ define('POSTIE_VERSION', '1.9.9');
39
  define('POSTIE_ROOT', dirname(__FILE__));
40
  define('POSTIE_URL', WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
41
 
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: e-mail, email, post-by-email
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.8.2
10
- Stable tag: 1.9.8
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -243,6 +243,9 @@ All script, style and body tags are stripped from html emails.
243
  Attachments are now processed in the order they were attached.
244
 
245
  == CHANGELOG ==
 
 
 
246
  = 1.9.8 (2017-10-23) =
247
  * Fix: check that global is initialized before using
248
 
7
  Requires PHP: 5.3
8
  Requires at least: 4.0
9
  Tested up to: 4.8.2
10
+ Stable tag: 1.9.9
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
243
  Attachments are now processed in the order they were attached.
244
 
245
  == CHANGELOG ==
246
+ = 1.9.9 (2017-10-30) =
247
+ * Fix: remove assumption that there is a user with the administrator role
248
+
249
  = 1.9.8 (2017-10-23) =
250
  * Fix: check that global is initialized before using
251