From 296c0cfb23ceaed21810362ffa467ddc381b75a2 Mon Sep 17 00:00:00 2001 From: nigeljamesstevenson <105309450+nigeljamesstevenson@users.noreply.github.com> Date: Thu, 2 May 2024 14:44:21 +0100 Subject: [PATCH] Update to display full woocommerce version on status page rather than a shortened milestone style version (#46906) * update to display actual woocommerce version on status page * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions --- ...06-update-woocommerce-version-on-status-page | 4 ++++ .../views/html-admin-page-status-report.php | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/46906-update-woocommerce-version-on-status-page diff --git a/plugins/woocommerce/changelog/46906-update-woocommerce-version-on-status-page b/plugins/woocommerce/changelog/46906-update-woocommerce-version-on-status-page new file mode 100644 index 00000000000..8cb3119adec --- /dev/null +++ b/plugins/woocommerce/changelog/46906-update-woocommerce-version-on-status-page @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Update the WooCommerce Status page to use the full plugin version to show dev, Beta and RC versions as opposed to only the milestone number \ No newline at end of file diff --git a/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php b/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php index 9b1ee933d70..e987509491d 100644 --- a/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php +++ b/plugins/woocommerce/includes/admin/views/html-admin-page-status-report.php @@ -29,6 +29,20 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons $active_plugins_count = is_countable( $active_plugins ) ? count( $active_plugins ) : 0; $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_plugins ) : 0; +// Include necessary WordPress file to use get_plugin_data() +if ( ! function_exists( 'get_plugin_data' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; +} +// Define the path to the main WooCommerce plugin file using the correct constant +$plugin_path = WP_PLUGIN_DIR . '/woocommerce/woocommerce.php'; +// Initialize the WooCommerce version variable +$wc_version = ''; +// Check if the plugin file exists before trying to access it +if (file_exists($plugin_path)) { + $plugin_data = get_plugin_data($plugin_path); + $wc_version = $plugin_data["Version"] ?? ''; // Use null coalescing operator to handle undefined index +} + ?>

@@ -78,7 +92,8 @@ $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_p : - + + :