219 lines
6.7 KiB
Markdown
219 lines
6.7 KiB
Markdown
# WP Digital Download
|
|
|
|
A comprehensive WordPress plugin for creating a digital download marketplace where creators can sell digital products with PayPal integration.
|
|
|
|
## Features
|
|
|
|
### Core Functionality
|
|
- **Custom Post Type**: Products with rich metadata
|
|
- **User Roles**: Separate roles for customers and creators
|
|
- **File Management**: Secure file upload and protection
|
|
- **PayPal Integration**: Complete payment processing
|
|
- **Download Protection**: Secure, time-limited downloads
|
|
- **Watermarking**: Automatic watermarking for images and PDFs
|
|
- **Purchase History**: Customer account management
|
|
- **Admin Dashboard**: Complete order and sales management
|
|
|
|
### Key Components
|
|
|
|
#### Custom Post Types
|
|
- **wpdd_product**: Digital products with pricing, files, and settings
|
|
- **Product Categories & Tags**: Organization and filtering
|
|
- **Creator Attribution**: Products linked to their creators
|
|
|
|
#### User Management
|
|
- **Digital Customer Role**: Purchase and download permissions
|
|
- **Digital Creator Role**: Product management permissions
|
|
- **Admin Capabilities**: Full system management
|
|
|
|
#### Payment Processing
|
|
- **PayPal Integration**: Sandbox and live modes
|
|
- **Free Products**: No-payment downloads
|
|
- **Guest Checkout**: Optional account creation
|
|
- **Order Management**: Complete transaction tracking
|
|
|
|
#### File Protection
|
|
- **Protected Directory**: Files stored outside web root access
|
|
- **Secure Downloads**: Token-based download links
|
|
- **Download Limits**: Configurable per product
|
|
- **Expiry Dates**: Time-limited access
|
|
|
|
#### Watermarking
|
|
- **Image Watermarking**: PNG, JPG, GIF support
|
|
- **PDF Watermarking**: Text overlay on PDF files
|
|
- **Dynamic Content**: Customer info in watermarks
|
|
- **Configurable Settings**: Per-product control
|
|
|
|
## Installation
|
|
|
|
1. Upload the plugin files to `/wp-content/plugins/wp-digital-download/`
|
|
2. Activate the plugin through the WordPress admin
|
|
3. Configure PayPal settings in Digital Products > Settings
|
|
4. Create your first product
|
|
5. Add the shop shortcode `[wpdd_shop]` to a page
|
|
|
|
## Configuration
|
|
|
|
### PayPal Setup
|
|
1. Create a PayPal Developer account
|
|
2. Create a new application
|
|
3. Get Client ID and Secret
|
|
4. Configure in Settings > PayPal Settings
|
|
|
|
### Pages Setup
|
|
The plugin automatically creates these pages:
|
|
- **Shop**: `[wpdd_shop]` - Product listing
|
|
- **Checkout**: `[wpdd_checkout]` - Payment processing
|
|
- **My Purchases**: `[wpdd_customer_purchases]` - Customer downloads
|
|
- **Thank You**: `[wpdd_thank_you]` - Order confirmation
|
|
|
|
## Shortcodes
|
|
|
|
### Main Shortcodes
|
|
- `[wpdd_shop]` - Display product storefront
|
|
- `[wpdd_customer_purchases]` - Customer purchase history
|
|
- `[wpdd_checkout]` - Checkout form
|
|
- `[wpdd_thank_you]` - Thank you page
|
|
- `[wpdd_product id="123"]` - Single product display
|
|
|
|
### Shop Shortcode Options
|
|
```
|
|
[wpdd_shop columns="3" per_page="12" category="design" orderby="date" order="DESC" show_filters="yes"]
|
|
```
|
|
|
|
## Database Structure
|
|
|
|
### Tables Created
|
|
- `wp_wpdd_orders` - Purchase records
|
|
- `wp_wpdd_downloads` - Download tracking
|
|
- `wp_wpdd_download_links` - Secure download tokens
|
|
|
|
### Key Meta Fields
|
|
- `_wpdd_price` - Product price
|
|
- `_wpdd_sale_price` - Sale price
|
|
- `_wpdd_is_free` - Free product flag
|
|
- `_wpdd_files` - Associated files
|
|
- `_wpdd_download_limit` - Download restrictions
|
|
- `_wpdd_download_expiry` - Access duration
|
|
- `_wpdd_enable_watermark` - Watermark settings
|
|
- `_wpdd_sales_count` - Sales tracking
|
|
|
|
## File Structure
|
|
|
|
```
|
|
wp-digital-download/
|
|
├── wp-digital-download.php # Main plugin file
|
|
├── includes/ # Core functionality
|
|
│ ├── class-wpdd-install.php # Installation routines
|
|
│ ├── class-wpdd-post-types.php # Custom post types
|
|
│ ├── class-wpdd-roles.php # User roles
|
|
│ ├── class-wpdd-metaboxes.php # Product editing
|
|
│ ├── class-wpdd-shortcodes.php # Frontend display
|
|
│ ├── class-wpdd-paypal.php # Payment processing
|
|
│ ├── class-wpdd-download-handler.php # File delivery
|
|
│ ├── class-wpdd-customer.php # Customer management
|
|
│ ├── class-wpdd-orders.php # Order processing
|
|
│ ├── class-wpdd-file-protection.php # Security
|
|
│ ├── class-wpdd-watermark.php # Image processing
|
|
│ └── class-wpdd-ajax.php # AJAX handlers
|
|
├── admin/ # Admin interface
|
|
│ ├── class-wpdd-admin.php # Admin pages
|
|
│ └── class-wpdd-settings.php # Configuration
|
|
└── assets/ # Frontend resources
|
|
├── css/
|
|
│ ├── frontend.css # Public styling
|
|
│ └── admin.css # Admin styling
|
|
└── js/
|
|
├── frontend.js # Public scripts
|
|
├── admin.js # Admin scripts
|
|
└── paypal.js # Payment integration
|
|
```
|
|
|
|
## Hooks & Filters
|
|
|
|
### Actions
|
|
- `wpdd_order_completed` - Fired when order is completed
|
|
- `wpdd_download_started` - Before file delivery
|
|
- `wpdd_customer_registered` - New customer account
|
|
|
|
### Filters
|
|
- `wpdd_product_price` - Modify displayed price
|
|
- `wpdd_download_url` - Customize download URLs
|
|
- `wpdd_watermark_text` - Modify watermark content
|
|
- `wpdd_email_content` - Customize email templates
|
|
|
|
## Security Features
|
|
|
|
### File Protection
|
|
- Files stored in protected directory with .htaccess rules
|
|
- Token-based download authentication
|
|
- Time-limited access links
|
|
- IP and user agent logging
|
|
|
|
### Input Validation
|
|
- All user inputs sanitized
|
|
- Nonce verification on forms
|
|
- Capability checks for admin functions
|
|
- SQL injection prevention
|
|
|
|
### Payment Security
|
|
- PayPal webhook verification
|
|
- Transaction ID tracking
|
|
- Duplicate payment prevention
|
|
- Secure credential storage
|
|
|
|
## Customization
|
|
|
|
### Template Override
|
|
Create templates in your theme:
|
|
```
|
|
your-theme/
|
|
└── wpdd-templates/
|
|
├── single-product.php
|
|
├── shop.php
|
|
└── checkout.php
|
|
```
|
|
|
|
### CSS Customization
|
|
Override default styles:
|
|
```css
|
|
.wpdd-product-card {
|
|
/* Your custom styles */
|
|
}
|
|
```
|
|
|
|
### Adding Payment Methods
|
|
Extend payment options by hooking into:
|
|
```php
|
|
add_action('wpdd_payment_methods', 'add_stripe_payment');
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- WordPress 5.0+
|
|
- PHP 7.4+
|
|
- MySQL 5.6+
|
|
- cURL extension
|
|
- GD library (for watermarking)
|
|
|
|
## Changelog
|
|
|
|
### Version 1.0.0
|
|
- Initial release
|
|
- PayPal integration
|
|
- File protection system
|
|
- Watermarking capabilities
|
|
- Customer management
|
|
- Admin dashboard
|
|
|
|
## Support
|
|
|
|
For support and feature requests, please create an issue in the GitHub repository.
|
|
|
|
## License
|
|
|
|
This plugin is licensed under the GPL v2 or later.
|
|
|
|
---
|
|
|
|
**Note**: This plugin handles financial transactions. Always test thoroughly in a development environment before deploying to production. |