Auto Post Thumbnail - Version 3.3.3

Version Description

  • Fix for SQL error begin caused due to no ID
Download this release

Release Info

Developer tariquesani
Plugin Icon 128x128 Auto Post Thumbnail
Version 3.3.3
Comparing to
See all releases

Code changes from version 3.3.2 to 3.3.3

Files changed (2) hide show
  1. auto-post-thumbnail.php +4 -5
  2. readme.txt +4 -1
auto-post-thumbnail.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Auto Post Thumbnail
5
  Plugin URI: http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-automatic-post-thumbnail/
6
  Description: Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post (or any custom post type) only if Post Thumbnail is not set manually.
7
- Version: 3.3.2
8
  Author: Aditya Mooley <adityamooley@sanisoft.com>, Tarique Sani <tarique@sanisoft.com>
9
  Author URI: http://www.sanisoft.com/blog/author/adityamooley/
10
  Modified by Dr. Tarique Sani <tarique@sanisoft.com> to make it work with Wordpress 3.4
@@ -30,7 +30,7 @@ Modified by Dr. Tarique Sani <tarique@sanisoft.com> to make it work with Wordpre
30
  add_action('publish_post', 'apt_publish_post');
31
 
32
  // This hook will now handle all sort publishing including posts, custom types, scheduled posts, etc.
33
- add_action('transition_post_status', 'apt_check_required_transition');
34
 
35
  add_action('admin_notices', 'apt_check_perms');
36
  add_action('admin_menu', 'apt_add_admin_menu'); // Add batch process capability
@@ -73,7 +73,7 @@ function apt_interface() {
73
 
74
  // Get id's of all the published posts for which post thumbnails does not exist.
75
  $query = "SELECT * FROM {$wpdb->posts} p where p.post_status = 'publish' AND p.ID NOT IN (
76
- SELECT DISTINCT post_id FROM {$wpdb->postmeta} WHERE meta_key IN (' _thumbnail_id', 'skip_post_thumb')
77
  )";
78
  $posts = $wpdb->get_results($query);
79
 
@@ -261,10 +261,9 @@ function apt_check_perms() {
261
  * @return void
262
  */
263
  function apt_check_required_transition($new_status='', $old_status='', $post='') {
264
- global $post_ID; // Using the post id from global reference since it is not available in $post object. Strange!
265
 
266
  if ('publish' == $new_status) {
267
- apt_publish_post($post_ID);
268
  }
269
  }
270
 
4
  Plugin Name: Auto Post Thumbnail
5
  Plugin URI: http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-automatic-post-thumbnail/
6
  Description: Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post (or any custom post type) only if Post Thumbnail is not set manually.
7
+ Version: 3.3.3
8
  Author: Aditya Mooley <adityamooley@sanisoft.com>, Tarique Sani <tarique@sanisoft.com>
9
  Author URI: http://www.sanisoft.com/blog/author/adityamooley/
10
  Modified by Dr. Tarique Sani <tarique@sanisoft.com> to make it work with Wordpress 3.4
30
  add_action('publish_post', 'apt_publish_post');
31
 
32
  // This hook will now handle all sort publishing including posts, custom types, scheduled posts, etc.
33
+ add_action('transition_post_status', 'apt_check_required_transition', 10, 3);
34
 
35
  add_action('admin_notices', 'apt_check_perms');
36
  add_action('admin_menu', 'apt_add_admin_menu'); // Add batch process capability
73
 
74
  // Get id's of all the published posts for which post thumbnails does not exist.
75
  $query = "SELECT * FROM {$wpdb->posts} p where p.post_status = 'publish' AND p.ID NOT IN (
76
+ SELECT DISTINCT post_id FROM {$wpdb->postmeta} WHERE meta_key IN ('_thumbnail_id', 'skip_post_thumb')
77
  )";
78
  $posts = $wpdb->get_results($query);
79
 
261
  * @return void
262
  */
263
  function apt_check_required_transition($new_status='', $old_status='', $post='') {
 
264
 
265
  if ('publish' == $new_status) {
266
+ apt_publish_post($post->ID);
267
  }
268
  }
269
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: adityamooley
3
  Tags: Post, thumbnail, automatic, posts, featured image, image, featured, images, admin
4
  Requires at least: 2.9.1
5
  Tested up to: 3.6.x
6
- Stable tag: 3.3.2
7
 
8
  Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post or any custom post type only if Post Thumbnail is not set manually.
9
 
@@ -27,6 +27,9 @@ For more details, see http://www.sanisoft.com/blog/2010/04/19/wordpress-plugin-a
27
 
28
  == Changelog ==
29
 
 
 
 
30
  = 3.3.2 =
31
  * Tested with WordPress-3.6.x
32
  * Small tweaks
3
  Tags: Post, thumbnail, automatic, posts, featured image, image, featured, images, admin
4
  Requires at least: 2.9.1
5
  Tested up to: 3.6.x
6
+ Stable tag: 3.3.3
7
 
8
  Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post or any custom post type only if Post Thumbnail is not set manually.
9
 
27
 
28
  == Changelog ==
29
 
30
+ = 3.3.3 =
31
+ * Fix for SQL error begin caused due to no ID
32
+
33
  = 3.3.2 =
34
  * Tested with WordPress-3.6.x
35
  * Small tweaks