diff --git a/includes/class-custom-action.php b/includes/class-custom-action.php index 01f6921d956b4c1f1c94a548a37a2782195fdd5b..5aaeb31fb9640d02673abfab11b5393b5fc3aea0 100644 --- a/includes/class-custom-action.php +++ b/includes/class-custom-action.php @@ -55,34 +55,6 @@ class Custom_Action { do_action( 'bulk_actions_cron_offload_custom_request_completed', $results, $vars ); } - /** - * Let the user know what's going on - * - * Not used for post-request redirect - */ - public static function admin_notices() { - $screen = get_current_screen(); - - $type = ''; - $message = ''; - - if ( 'edit' === $screen->base ) { - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { - return; - } - - $status = isset( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; - $pending = Main::get_post_ids_for_pending_events( self::ACTION, $screen->post_type, $status ); - - if ( ! empty( $pending ) ) { - $type = 'warning'; - $message = __( 'Some items that would normally be shown here are waiting to be processed. These items are hidden until processing completes.', 'bulk-actions-cron-offload' ); - } - } - - Main::render_admin_notice( $type, $message ); - } - /** * Provide post-redirect success message * @@ -101,6 +73,15 @@ class Custom_Action { return __( 'The requested processing is already pending for the chosen posts.', 'bulk-actions-cron-offload' ); } + /** + * Provide message when posts are hidden pending processing + * + * @return string + */ + public static function admin_notice_hidden_pending_processing() { + return __( 'Some items that would normally be shown here are waiting to be processed. These items are hidden until processing completes.', 'bulk-actions-cron-offload' ); + } + /** * When an edit is pending for a given post type, hide those posts in the admin * diff --git a/includes/class-edit.php b/includes/class-edit.php index 5361b30bec6a4cd1f98da36c7b1bcbb73d0f656b..d153944baf79dc027a59e1bbf085ffff572fa3ca 100644 --- a/includes/class-edit.php +++ b/includes/class-edit.php @@ -75,34 +75,6 @@ class Edit { do_action( 'bulk_actions_cron_offload_edit_request_completed', $results, $vars ); } - /** - * Let the user know what's going on - * - * Not used for post-request redirect - */ - public static function admin_notices() { - $screen = get_current_screen(); - - $type = ''; - $message = ''; - - if ( 'edit' === $screen->base ) { - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { - return; - } - - $status = isset( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; - $pending = Main::get_post_ids_for_pending_events( self::ACTION, $screen->post_type, $status ); - - if ( ! empty( $pending ) ) { - $type = 'warning'; - $message = __( 'Some items that would normally be shown here are waiting to be edited. These items are hidden until they are processed.', 'bulk-actions-cron-offload' ); - } - } - - Main::render_admin_notice( $type, $message ); - } - /** * Provide post-redirect success message * @@ -121,6 +93,15 @@ class Edit { return __( 'The requested edits are already pending for the chosen posts.', 'bulk-actions-cron-offload' ); } + /** + * Provide notice when posts are hidden pending edits + * + * @return string + */ + public static function admin_notice_hidden_pending_processing() { + return __( 'Some items that would normally be shown here are waiting to be edited. These items are hidden until they are processed.', 'bulk-actions-cron-offload' ); + } + /** * When an edit is pending for a given post type, hide those posts in the admin * diff --git a/includes/trait-bulk-actions.php b/includes/trait-bulk-actions.php index 4580755d8cde157294f8e4533da4ee10050b0a3a..3417e2a57b6e49a051d72d9a2f5ad39d9c27436f 100644 --- a/includes/trait-bulk-actions.php +++ b/includes/trait-bulk-actions.php @@ -67,6 +67,34 @@ trait Bulk_Actions { self::admin_notices(); } + /** + * Let the user know what's going on + * + * Not used for post-request redirect + */ + public static function admin_notices() { + $screen = get_current_screen(); + + $type = ''; + $message = ''; + + if ( 'edit' === $screen->base ) { + if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { + return; + } + + $status = isset( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; + $pending = Main::get_post_ids_for_pending_events( self::ACTION, $screen->post_type, $status ); + + if ( ! empty( $pending ) ) { + $type = 'warning'; + $message = self::admin_notice_hidden_pending_processing(); + } + } + + Main::render_admin_notice( $type, $message ); + } + /** * Provide translated success message for bulk action * @@ -85,6 +113,15 @@ trait Bulk_Actions { return ''; } + /** + * Provide translated message when posts are hidden pending processing + * + * @return string + */ + public static function admin_notice_hidden_pending_processing() { + return ''; + } + /** * When an edit is pending for a given post type, hide those posts in the admin *