From d75b3eae395eb11ae57da3a896546c647528d1f0 Mon Sep 17 00:00:00 2001 From: xxsimoxx Date: Fri, 10 Apr 2020 18:03:44 +0200 Subject: [PATCH] Fixed bug with deleted transient --- stats-for-update-manager.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stats-for-update-manager.php b/stats-for-update-manager.php index a51dcb0..1e40720 100755 --- a/stats-for-update-manager.php +++ b/stats-for-update-manager.php @@ -419,12 +419,10 @@ public function delete_action() { $deleted = $wpdb->delete($wpdb->prefix.DB_TABLE_NAME, $where); // Redirect to right url. + set_transient('sfum_deleted_item', $name); $sendback = remove_query_arg(['action', 'id', '_sfum'], wp_get_referer()); - if ($deleted > 0) { - $sendback = add_query_arg('deleted', urlencode($name), $sendback); - } wp_redirect($sendback); - + exit; } // Enqueue CSS for debug section only in the page and only if WP_DEBUG is true. @@ -442,9 +440,11 @@ public function render_page() { echo '

'.esc_html_x('Update Manager – Statistics', 'Page Title', 'stats-for-update-manager').'

'; // Give feedback to the user about deleted item from row actions. - if (isset($_GET['deleted'])) { + $deleted_name = get_transient('sfum_deleted_item'); + if ($deleted_name !== false) { // Translators: %1$s is plugin or theme name. - echo '

'.sprintf(__('Statistics for %1$s has been successfully reset.', 'stats-for-update-manager'), $_GET['deleted']).'

'; + echo '

'.sprintf(__('Statistics for %1$s has been successfully reset.', 'stats-for-update-manager'), $deleted_name).'

'; + delete_transient('sfum_deleted_item'); } // Render list table.