Update documentation to reflect recent bug fixes and improvements

Added comprehensive documentation for:
- Download limits default fix (unlimited downloads)
- Enhanced license key display with FontAwesome icons
- Software license filename sanitization implementation
- Technical architecture discoveries for file handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-09 19:04:07 -07:00
parent 6d797ef686
commit 6d86d5ef4f

102
CLAUDE.md
View File

@@ -9,16 +9,9 @@ This is a comprehensive WordPress plugin for creating a digital download marketp
## Development Commands
### Testing
- `npm test` - Run all Playwright E2E tests
- `npm run test:headed` - Run tests with browser UI visible
- `npm run test:debug` - Run tests in debug mode
- `npm run test:ui` - Run tests with Playwright UI
### E2E Testing Configuration
- Tests are configured for `https://streamers.channel` (live site)
- Test files located in `tests/e2e/`
- Uses Playwright with Chromium browser
- Admin credentials stored in test file for WordPress login tests
- Use Browser MCP to test the site.
- Admin credentials are in the section: WordPress Admin Access
## Architecture Overview
@@ -29,6 +22,7 @@ The plugin follows WordPress standards with a singleton main class `WP_Digital_D
- Defines plugin constants and initializes the main class
- Handles dependency loading and hook initialization
- Manages script/style enqueuing with cache busting
- Integrates FontAwesome CDN for frontend icons (copy buttons, etc.)
### Core Components
@@ -36,6 +30,8 @@ The plugin follows WordPress standards with a singleton main class `WP_Digital_D
- Custom post type `wpdd_product` for digital products
- Rich metadata system for pricing, files, download limits
- Creator attribution and sales tracking
- Default download limit set to 0 (unlimited) for new products
- Proper handling of unlimited vs limited download configurations
**Payment Processing** (`includes/class-wpdd-paypal.php`)
- PayPal API integration (sandbox/live modes)
@@ -47,6 +43,8 @@ The plugin follows WordPress standards with a singleton main class `WP_Digital_D
- Token-based download authentication
- Time-limited and usage-limited downloads
- Download tracking and logging
- Software license files stored locally in `wp-content/uploads/wpdd-packages/`
- Filename sanitization for downloads (spaces→dashes, dots→underscores, proper extensions)
**User Management** (`includes/class-wpdd-roles.php`, `includes/class-wpdd-customer.php`)
- Custom roles: Digital Customer, Digital Creator
@@ -57,6 +55,8 @@ The plugin follows WordPress standards with a singleton main class `WP_Digital_D
- Shortcodes: `[wpdd_shop]`, `[wpdd_checkout]`, `[wpdd_customer_purchases]`, etc.
- Product grids, filtering, and pagination
- Responsive design support
- Enhanced license key display with FontAwesome copy icons
- Improved customer purchases table layout with full-width license key rows
**Admin Interface** (`admin/class-wpdd-admin.php`, `admin/class-wpdd-settings.php`)
- Admin dashboard for orders and sales management
@@ -81,6 +81,37 @@ The plugin follows WordPress standards with a singleton main class `WP_Digital_D
- `[wpdd_thank_you]` - Order confirmation page
- `[wpdd_product id="123"]` - Single product display
## Recent Improvements and Bug Fixes
### Download Limits Fix (includes/class-wpdd-metaboxes.php)
- **Issue**: Products set to unlimited downloads were incorrectly showing limits instead of unlimited
- **Fix**: Changed default download limit from 5 to 0 (unlimited) in metabox configuration
- **Impact**: New products now default to unlimited downloads as intended
### License Key Display Enhancement (includes/class-wpdd-shortcodes.php, assets/css/frontend.css)
- **Improvement**: Restructured customer purchases table for better license key presentation
- **Changes**:
- Moved license keys from separate column to full-width spanning row
- Added FontAwesome copy icon for easy license key copying
- Implemented responsive CSS styling for license key display
- **New CSS Classes**: `.wpdd-license-row`, `.wpdd-license-cell`, `.wpdd-license-key`, `.wpdd-copy-icon`
### Software License Download Filename Sanitization
- **Files Modified**: `includes/class-wpdd-download-handler.php`, `includes/class-wpdd-api.php`
- **Issue**: Software license downloads had improper filenames with spaces and special characters
- **Solution**: Implemented comprehensive filename sanitization:
- Spaces converted to dashes
- Dots converted to underscores (except file extension)
- Proper .zip extension enforcement
- Version extraction from package paths
- **Example**: "Test Plugin v2.2.0" becomes "Test-Plugin-v2-2-0.zip"
- **Coverage**: Both regular download handler and API download paths
### Technical Architecture Discovery
- **Software License Storage**: Local storage in `wp-content/uploads/wpdd-packages/` (not external API)
- **Download Flow**: Token → `process_download_by_token()``process_download()``deliver_file()`
- **Dual Path Coverage**: Sanitization applied to both standard downloads and API update downloads
## Development Notes
### File Loading Pattern
@@ -98,21 +129,28 @@ All classes are loaded conditionally with existence checks and error logging. Ad
- Separate CSS/JS for admin and frontend
- jQuery dependencies for interactive features
- Localized AJAX endpoints with nonces
- FontAwesome CDN integration for UI icons
### Testing Strategy
Comprehensive Playwright E2E tests covering:
- Product display and search functionality
- Free download workflow (with/without account creation)
- Admin panel integration
- Security validation (CSRF, XSS prevention)
- Responsive design testing
- Performance benchmarks
### Filename Sanitization Patterns
For software license downloads, the plugin implements standardized filename sanitization:
```php
// Pattern: Convert spaces to dashes, dots to underscores (except file extension)
$sanitized = str_replace([' ', '.'], ['-', '_'], $base_name) . '.zip';
// Example: "Test Plugin v2.2.0" → "Test-Plugin-v2-2-0.zip"
```
Applied in both `class-wpdd-download-handler.php` and `class-wpdd-api.php` for comprehensive coverage.
## Remote Deployment
- Website plugin folder is mounted locally via sshfs at /home/jknapp/remote-sftp
- Live site hosted at `https://streamers.channel`
- Test admin user: `playwright` (credentials in test files)
**SFTP Access:**
- Host: `shadowdao@whp01.cloud-hosting.io`
- Remote path: `/streamers.channel/public_html/wp-content/plugins/wp-digital-download/`
- Use SFTP commands like: `sftp shadowdao@whp01.cloud-hosting.io`
**WordPress Admin Access:**
- Site URL: `https://streamers.channel`
- Username: `playwright`
- Password: `%Pzx*H1F(U79q6lQXsU)Ofxl`
## Important Patterns
@@ -133,12 +171,20 @@ Plugin automatically includes `wpdd_product` post type in WordPress search resul
### Website Current Status
- The site is currently hooked up to PayPal Sandbox
- The website has some test products
- One of the products is a free image and gets watermarked
- One is a PDF for $10 and should also be watermarked
### PayPal Sandbox Customer Credentials
These are sandbox only PayPal Test account. The credentials should be used to test the purchase process.
- sb-a7cpw45634739@personal.example.com
- 3[I$ppb?
- When copying files to ~/remote-sftp you MUST check if the file "THIS-IS-REMOTE" exists. If it does not exist, tell the user they need to mount the remote path.
- When using the playwright MCP, please use headless if possible.
### PayPal Sandbox Configuration
**Admin Credentials (for plugin settings):**
- Mode: Sandbox
- Client ID: `AW4tXomdLDd9tpZP6I3PsTDaDPTy5XYm1kwEu66uBUeRBFHtARweFrOAq_M9IXqYAYnBvC_YKK_n5tMI`
- Secret Key: `EOjAvXKP7wDiF_WLFRRx8Z7ccKM7ML7LpmRNSUVxzVL4wrJGq9sfDkHQAOkYEttEz0Wx_jnfPBtuFXiX`
**Test Customer Credentials (for making purchases):**
- Email: `sb-a7cpw45634739@personal.example.com`
- Password: `3[I$ppb?`
### Payment Holding System
- Default holding period: 15 days (configurable to 0 for immediate)
- Status flow: pending → available → paid
- Automated cron job processes earnings hourly
- Admin Order Manager available for cancellations/refunds
- IMPORTANT: Use Use a persistent context when using Playwright or Save and reuse authentication state when doing testing