Skip to content

Commit a823c92

Browse files
authored
Merge pull request #8 from arunbasillal/branch-3.2
Branch 3.2
2 parents 211f9e5 + ddbb5d4 commit a823c92

File tree

4 files changed

+681
-6
lines changed

4 files changed

+681
-6
lines changed

admin/iaff_image-attributes-from-filename-do.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,30 @@ function iaff_bulk_updater_skip_image() {
237237
$counter = get_option( 'iaff_bulk_updater_counter' );
238238
$counter = intval ( $counter );
239239

240+
global $wpdb;
241+
$image = $wpdb->get_row("SELECT ID, post_parent FROM {$wpdb->prefix}posts WHERE post_type='attachment' AND post_mime_type LIKE 'image%' ORDER BY post_date LIMIT 1 OFFSET {$counter}");
242+
243+
/**
244+
* Die if no image.
245+
* This happens if there are no more images to skip.
246+
*/
247+
if ( $image === NULL ) {
248+
$response = array(
249+
'message' => __( 'No more images to skip.', 'auto-image-attributes-from-filename-with-bulk-updater' ),
250+
'remaining_images' => iaff_count_remaining_images( true ),
251+
);
252+
wp_send_json( $response );
253+
}
254+
255+
// Extract the image url
256+
$image_url = wp_get_attachment_url($image->ID);
257+
240258
// Increment counter and update it
241259
$counter++;
242260
update_option( 'iaff_bulk_updater_counter', $counter );
243261

244262
$response = array(
245-
'message' => __( 'One image skipped.', 'auto-image-attributes-from-filename-with-bulk-updater' ),
263+
'message' => __( 'Image skipped: ', 'auto-image-attributes-from-filename-with-bulk-updater' ) . '<a href="'. get_edit_post_link( $image->ID ) .'">'. $image_url .'</a>',
246264
'remaining_images' => iaff_count_remaining_images( true ),
247265
);
248266
wp_send_json( $response );
@@ -445,7 +463,7 @@ function iaff_do_bulk_updater(iaff_test=false) {
445463
};
446464

447465
$.post(ajaxurl, data, function (response) {
448-
$('#bulk-updater-log').append('<p class="iaff-green"><span class="dashicons dashicons-yes"></span>' + response.message + '</p>');
466+
$('#bulk-updater-log').append('<p class="iaff-red"><span class="dashicons dashicons-remove"></span> ' + response.message + '</p>');
449467
$('#bulk-updater-log').append('<p>Number of Images Remaining: ' + response.remaining_images + '</p>');
450468
$("#bulk-updater-log").animate({scrollTop:$("#bulk-updater-log")[0].scrollHeight - $("#bulk-updater-log").height()},200);
451469
});

iaff_image-attributes-from-filename.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Automatically Add Image Title, Image Caption, Description And Alt Text From Image Filename. Since this plugin includes a bulk updater this can update both existing images in the Media Library and new images.
66
* Author: Arun Basil Lal
77
* Author URI: https://imageattributespro.com/?utm_source=plugin-header&utm_medium=author-uri
8-
* Version: 3.1
8+
* Version: 3.2
99
* Text Domain: auto-image-attributes-from-filename-with-bulk-updater
1010
* Domain Path: /languages
1111
* License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@@ -67,7 +67,7 @@
6767
* @since 1.3
6868
*/
6969
if ( ! defined( 'IAFF_VERSION_NUM' ) ) {
70-
define( 'IAFF_VERSION_NUM', '3.1' );
70+
define( 'IAFF_VERSION_NUM', '3.2' );
7171
}
7272

7373
/**

0 commit comments

Comments
 (0)