From 1bc643408e479e4d816b6565876859ab7e9128d3 Mon Sep 17 00:00:00 2001 From: magdev Date: Thu, 22 Jan 2026 19:39:26 +0100 Subject: [PATCH] Fix version deactivation button not working (v0.3.3) The toggle version button in the admin product versions table was not deactivating versions due to incorrect parameter order in the updateVersion() call. The isActive value was being passed to the attachmentId parameter position instead. - Fixed parameter order: updateVersion($id, null, !$active, null) - Bumped version to 0.3.3 - Updated CHANGELOG.md Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 15 ++++++++++++++- src/Admin/VersionAdminController.php | 2 +- wc-licensed-product.php | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb3cf11..c463668 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.3] - 2026-01-22 + +### Fixed + +- Fixed version deactivation button not working in admin product versions table +- Corrected parameter order in `updateVersion()` call - `isActive` was being passed to `attachmentId` parameter + +### Technical Details + +- Bug in `VersionAdminController::ajaxToggleVersion()` - parameters were in wrong order +- Changed from `updateVersion($versionId, null, null, !$currentlyActive)` to `updateVersion($versionId, null, !$currentlyActive, null)` + ## [0.3.2] - 2026-01-22 ### Changed @@ -425,7 +437,8 @@ define('WC_LICENSE_SERVER_SECRET', 'your-secure-random-string-min-32-chars'); - WordPress REST API integration - Custom WooCommerce product type extending WC_Product -[Unreleased]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.3.2...HEAD +[Unreleased]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.3.3...HEAD +[0.3.3]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.3.2...v0.3.3 [0.3.2]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.3.1...v0.3.2 [0.3.1]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.3.0...v0.3.1 [0.3.0]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.2.2...v0.3.0 diff --git a/src/Admin/VersionAdminController.php b/src/Admin/VersionAdminController.php index b50cd13..a559d0e 100644 --- a/src/Admin/VersionAdminController.php +++ b/src/Admin/VersionAdminController.php @@ -361,7 +361,7 @@ final class VersionAdminController wp_send_json_error(['message' => __('Version ID is required.', 'wc-licensed-product')]); } - $result = $this->versionManager->updateVersion($versionId, null, null, !$currentlyActive); + $result = $this->versionManager->updateVersion($versionId, null, !$currentlyActive, null); if (!$result) { wp_send_json_error(['message' => __('Failed to update version.', 'wc-licensed-product')]); diff --git a/wc-licensed-product.php b/wc-licensed-product.php index 1bbd895..178b7f3 100644 --- a/wc-licensed-product.php +++ b/wc-licensed-product.php @@ -3,7 +3,7 @@ * Plugin Name: WooCommerce Licensed Product * Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-licensed-product * Description: WooCommerce plugin to sell software products using license keys with domain-based validation. - * Version: 0.3.2 + * Version: 0.3.3 * Author: Marco Graetsch * Author URI: https://src.bundespruefstelle.ch/magdev * License: GPL-2.0-or-later @@ -28,7 +28,7 @@ if (!defined('ABSPATH')) { } // Plugin constants -define('WC_LICENSED_PRODUCT_VERSION', '0.3.2'); +define('WC_LICENSED_PRODUCT_VERSION', '0.3.3'); define('WC_LICENSED_PRODUCT_PLUGIN_FILE', __FILE__); define('WC_LICENSED_PRODUCT_PLUGIN_DIR', plugin_dir_path(__FILE__)); define('WC_LICENSED_PRODUCT_PLUGIN_URL', plugin_dir_url(__FILE__));