Major improvements: Fix download limits, enhance license display, fix software filenames
🔧 Bug Fixes: - Fixed download limits defaulting to 5 instead of 0 for unlimited downloads - Fixed software license filename sanitization (spaces→dashes, dots→underscores, proper .zip extension) - Software downloads now show as "Test-Plugin-v2-2-0.zip" instead of "Test Plugin v2.2.0" ✨ UI/UX Enhancements: - Redesigned license key display to span full table width with FontAwesome copy icons - Added responsive CSS styling for license key rows - Integrated FontAwesome CDN for modern copy icons 🏗️ Architecture Improvements: - Added comprehensive filename sanitization in both download handler and API paths - Enhanced software license product handling for local package files - Improved error handling and logging throughout download processes 📦 Infrastructure: - Added Gitea workflows for automated releases on push to main - Created comprehensive .gitignore excluding test files and browser automation - Updated documentation with all recent improvements and technical insights 🔍 Technical Details: - Software license products served from wp-content/uploads/wpdd-packages/ - Download flow: token → process_download_by_token() → process_download() → deliver_file() - Dual path coverage for both API downloads and regular file delivery - Version placeholder system for automated deployment 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ class WPDD_License_Manager {
|
||||
* Initialize the license manager
|
||||
*/
|
||||
public static function init() {
|
||||
add_action('wpdd_order_completed', array(__CLASS__, 'generate_license_for_order'), 10, 2);
|
||||
add_action('wpdd_order_completed', array(__CLASS__, 'generate_license_for_order'), 10, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,12 +28,28 @@ class WPDD_License_Manager {
|
||||
/**
|
||||
* Generate license for completed order
|
||||
*/
|
||||
public static function generate_license_for_order($order_id, $order) {
|
||||
public static function generate_license_for_order($order_id) {
|
||||
global $wpdb;
|
||||
|
||||
error_log('WPDD License Debug: generate_license_for_order called for order ID: ' . $order_id);
|
||||
|
||||
// Get the order details
|
||||
$order = $wpdb->get_row($wpdb->prepare(
|
||||
"SELECT * FROM {$wpdb->prefix}wpdd_orders WHERE id = %d",
|
||||
$order_id
|
||||
));
|
||||
|
||||
if (!$order) {
|
||||
error_log('WPDD License Debug: Order not found for ID: ' . $order_id);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if product is software license type
|
||||
$product_type = get_post_meta($order->product_id, '_wpdd_product_type', true);
|
||||
error_log('WPDD License Debug: Product type for product ' . $order->product_id . ': ' . $product_type);
|
||||
|
||||
if ($product_type !== 'software_license') {
|
||||
error_log('WPDD License Debug: Product type is not software_license, skipping license generation');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -44,9 +60,12 @@ class WPDD_License_Manager {
|
||||
));
|
||||
|
||||
if ($existing) {
|
||||
error_log('WPDD License Debug: License already exists for order ' . $order_id . ', license ID: ' . $existing);
|
||||
return;
|
||||
}
|
||||
|
||||
error_log('WPDD License Debug: Generating new license for order ' . $order_id);
|
||||
|
||||
// Generate unique license key
|
||||
$license_key = self::generate_license_key();
|
||||
|
||||
@@ -81,6 +100,12 @@ class WPDD_License_Manager {
|
||||
array('%s', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%s')
|
||||
);
|
||||
|
||||
if ($wpdb->insert_id) {
|
||||
error_log('WPDD License Debug: License created successfully with ID: ' . $wpdb->insert_id . ', license key: ' . $license_key);
|
||||
} else {
|
||||
error_log('WPDD License Debug: Failed to create license. Last error: ' . $wpdb->last_error);
|
||||
}
|
||||
|
||||
// Send license key to customer
|
||||
self::send_license_email($order, $license_key);
|
||||
|
||||
|
Reference in New Issue
Block a user