Skip to content
Snippets Groups Projects
Commit ee296499 authored by Erick Hitter's avatar Erick Hitter
Browse files

Display notice for anyone who accesses the trash while a purge is pending

parent 49ba1f03
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment