Skip to content

Commit

Permalink
Fixed bug with deleted transient
Browse files Browse the repository at this point in the history
  • Loading branch information
xxsimoxx committed Apr 10, 2020
1 parent 818ee5a commit d75b3ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stats-for-update-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -442,9 +440,11 @@ public function render_page() {
echo '<h1 class="wp-heading-inline" style="margin-bottom:10px;">'.esc_html_x('Update Manager &#8211; Statistics', 'Page Title', 'stats-for-update-manager').'</h1>';

// 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 '<div class="notice notice-success is-dismissible"><p>'.sprintf(__('Statistics for %1$s has been successfully reset.', 'stats-for-update-manager'), $_GET['deleted']).'</p></div>';
echo '<div class="notice notice-success is-dismissible"><p>'.sprintf(__('Statistics for %1$s has been successfully reset.', 'stats-for-update-manager'), $deleted_name).'</p></div>';
delete_transient('sfum_deleted_item');
}

// Render list table.
Expand Down

0 comments on commit d75b3ea

Please sign in to comment.