diff --git a/packages/js/data/changelog/fix-remove-help-panel-user-meta b/packages/js/data/changelog/fix-remove-help-panel-user-meta new file mode 100644 index 00000000000..9b1882ac793 --- /dev/null +++ b/packages/js/data/changelog/fix-remove-help-panel-user-meta @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Removed the leftover user meta from the help panel spotlight diff --git a/packages/js/data/src/user/types.ts b/packages/js/data/src/user/types.ts index 34328a41f18..428b8e1a5e1 100644 --- a/packages/js/data/src/user/types.ts +++ b/packages/js/data/src/user/types.ts @@ -15,7 +15,6 @@ export type UserPreferences = { dashboard_chart_type?: string; dashboard_leaderboard_rows?: string; dashboard_sections?: string; - help_panel_highlight_shown?: string; homepage_layout?: string; homepage_stats?: string; orders_report_columns?: string; diff --git a/plugins/woocommerce/changelog/fix-remove-help-panel-user-meta b/plugins/woocommerce/changelog/fix-remove-help-panel-user-meta new file mode 100644 index 00000000000..9b1882ac793 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-remove-help-panel-user-meta @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Removed the leftover user meta from the help panel spotlight diff --git a/plugins/woocommerce/includes/class-wc-install.php b/plugins/woocommerce/includes/class-wc-install.php index 002844d49c4..ec17ff0c71c 100644 --- a/plugins/woocommerce/includes/class-wc-install.php +++ b/plugins/woocommerce/includes/class-wc-install.php @@ -268,6 +268,7 @@ class WC_Install { ), '9.4.0' => array( 'wc_update_940_add_phone_to_order_address_fts_index', + 'wc_update_940_remove_help_panel_highlight_shown', ), ); diff --git a/plugins/woocommerce/includes/wc-update-functions.php b/plugins/woocommerce/includes/wc-update-functions.php index e4f880a2a76..79c42ac89fe 100644 --- a/plugins/woocommerce/includes/wc-update-functions.php +++ b/plugins/woocommerce/includes/wc-update-functions.php @@ -2872,3 +2872,51 @@ function wc_update_940_add_phone_to_order_address_fts_index(): void { } } } + +/** + * Remove user meta associated with the key 'woocommerce_admin_help_panel_highlight_shown'. + * + * This key is no longer needed since the help panel spotlight tour has been removed. + * + * @return void + */ +function wc_update_940_remove_help_panel_highlight_shown() { + global $wpdb; + + $meta_key = 'woocommerce_admin_help_panel_highlight_shown'; + + $deletions = $wpdb->query( + $wpdb->prepare( + "DELETE FROM $wpdb->usermeta WHERE meta_key = %s", + $meta_key + ) + ); + + // Get the WooCommerce logger to track the results of the deletion. + $logger = wc_get_logger(); + + if ( null === $logger ) { + return; + } + + if ( false === $deletions ) { + $logger->notice( + 'During the update to 9.4.0, WooCommerce attempted to remove user meta with the key "woocommerce_admin_help_panel_highlight_shown", but was unable to do so.', + array( + 'source' => 'wc-updater', + ) + ); + } else { + $logger->info( + sprintf( + 1 === $deletions + ? 'During the update to 9.4.0, WooCommerce removed %d user meta row associated with the meta key "woocommerce_admin_help_panel_highlight_shown".' + : 'During the update to 9.4.0, WooCommerce removed %d user meta rows associated with the meta key "woocommerce_admin_help_panel_highlight_shown".', + number_format_i18n( $deletions ) + ), + array( + 'source' => 'wc-updater', + ) + ); + } +} diff --git a/plugins/woocommerce/src/Internal/Admin/Homescreen.php b/plugins/woocommerce/src/Internal/Admin/Homescreen.php index 1a9cd90f776..dfb0cde522e 100644 --- a/plugins/woocommerce/src/Internal/Admin/Homescreen.php +++ b/plugins/woocommerce/src/Internal/Admin/Homescreen.php @@ -166,7 +166,6 @@ class Homescreen { 'homepage_layout', 'homepage_stats', 'task_list_tracked_started_tasks', - 'help_panel_highlight_shown', ) ); }