diff --git a/includes/class-delete-all.php b/includes/class-delete-all.php index 261bf5e6e61dd282a7a24ae1cc7c0244ba6d8fa5..e8978509619b1bd57308982b2f810a490b7f9291 100644 --- a/includes/class-delete-all.php +++ b/includes/class-delete-all.php @@ -109,16 +109,26 @@ class Delete_All { * Let the user know what's going on */ public static function admin_notices() { - if ( ! isset( $_REQUEST[ self::ADMIN_NOTICE_KEY ] ) ) { - return; + $screen = get_current_screen(); + + if ( isset( $_REQUEST[ self::ADMIN_NOTICE_KEY ] ) ) { + if ( 1 === (int) $_REQUEST[self::ADMIN_NOTICE_KEY] ) { + $class = 'notice-success'; + $message = __( 'Success! The trash will be emptied soon.', 'automattic-bulk-edit-cron-offload' ); + } else { + $class = 'notice-error'; + $message = __( 'A request to empty the trash is already pending for this post type.', 'automattic-bulk-edit-cron-offload' ); + } + } elseif ( 'edit' === $screen->base && isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { + if ( self::action_next_scheduled( self::CRON_EVENT, $screen->post_type ) ) { + $class = 'notice-warning'; + $message = __( 'A pending request to empty the trash will be processed soon.', 'automattic-bulk-edit-cron-offload' ); + } } - if ( 1 === (int) $_REQUEST[ self::ADMIN_NOTICE_KEY ] ) { - $class = 'notice-success'; - $message = __( 'Success! The trash will be emptied soon.', 'automattic-bulk-edit-cron-offload' ); - } else { - $class = 'notice-error'; - $message = __( 'A request to empty the trash is already pending for this post type.', 'automattic-bulk-edit-cron-offload' ); + // Nothing to display + if ( ! isset( $class ) || ! isset( $message ) ) { + return; } ?>