diff --git a/admin/iaff_image-attributes-from-filename-do.php b/admin/iaff_image-attributes-from-filename-do.php index 6ab9172..0e9e469 100644 --- a/admin/iaff_image-attributes-from-filename-do.php +++ b/admin/iaff_image-attributes-from-filename-do.php @@ -237,12 +237,30 @@ function iaff_bulk_updater_skip_image() { $counter = get_option( 'iaff_bulk_updater_counter' ); $counter = intval ( $counter ); + global $wpdb; + $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}"); + + /** + * Die if no image. + * This happens if there are no more images to skip. + */ + if ( $image === NULL ) { + $response = array( + 'message' => __( 'No more images to skip.', 'auto-image-attributes-from-filename-with-bulk-updater' ), + 'remaining_images' => iaff_count_remaining_images( true ), + ); + wp_send_json( $response ); + } + + // Extract the image url + $image_url = wp_get_attachment_url($image->ID); + // Increment counter and update it $counter++; update_option( 'iaff_bulk_updater_counter', $counter ); $response = array( - 'message' => __( 'One image skipped.', 'auto-image-attributes-from-filename-with-bulk-updater' ), + 'message' => __( 'Image skipped: ', 'auto-image-attributes-from-filename-with-bulk-updater' ) . ''. $image_url .'', 'remaining_images' => iaff_count_remaining_images( true ), ); wp_send_json( $response ); @@ -445,7 +463,7 @@ function iaff_do_bulk_updater(iaff_test=false) { }; $.post(ajaxurl, data, function (response) { - $('#bulk-updater-log').append('

' + response.message + '

'); + $('#bulk-updater-log').append('

' + response.message + '

'); $('#bulk-updater-log').append('

Number of Images Remaining: ' + response.remaining_images + '

'); $("#bulk-updater-log").animate({scrollTop:$("#bulk-updater-log")[0].scrollHeight - $("#bulk-updater-log").height()},200); }); diff --git a/readme.txt b/readme.txt index 850e21f..0c20f7f 100644 --- a/readme.txt +++ b/readme.txt @@ -149,10 +149,15 @@ I am glad to hear that! You can either [upgrade to pro](https://imageattributesp == Changelog == += 3.1 = +* Date: +* Tested with WordPress 5.9.3. +* Enhancement: Log message for `Skip Image` button now specifies which image is skipped and links to the `Edit Media` page for that image. + = 3.1 = * Date: 24.March.2022. * Tested with WordPress 5.9.2. -* New Feature: Added 'Skip Image' button for the Bulk Updater. Useful during troubleshooting. [Read more.](https://imageattributespro.com/fix-bulk-updater-stuck-on-same-image/?utm_source=wordpress.org&utm_medium=changelog) +* New Feature: Added `Skip Image` button for the Bulk Updater. Useful during troubleshooting. [Read more.](https://imageattributespro.com/fix-bulk-updater-stuck-on-same-image/?utm_source=wordpress.org&utm_medium=changelog) * Enhancement: Compatibility with Image Attributes Pro version 3.0. [Check what's new in 3.0.](https://imageattributespro.com/changelog/?utm_source=wordpress.org&utm_medium=changelog) = 3.0 =