diff --git a/.playwright-mcp/page-2025-08-29T02-49-20-380Z.png b/.playwright-mcp/page-2025-08-29T02-49-20-380Z.png
new file mode 100644
index 0000000..7cdba0f
Binary files /dev/null and b/.playwright-mcp/page-2025-08-29T02-49-20-380Z.png differ
diff --git a/CLAUDE.md b/CLAUDE.md
index e96e5e2..b844676 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -139,4 +139,6 @@ Plugin automatically includes `wpdd_product` post type in WordPress search resul
### 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?
\ No newline at end of file
+- 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.
\ No newline at end of file
diff --git a/admin/class-wpdd-admin-payouts.php b/admin/class-wpdd-admin-payouts.php
index 3ba64db..35beedc 100644
--- a/admin/class-wpdd-admin-payouts.php
+++ b/admin/class-wpdd-admin-payouts.php
@@ -10,6 +10,10 @@ class WPDD_Admin_Payouts {
add_action('admin_menu', array(__CLASS__, 'add_menu_page'));
add_action('admin_post_wpdd_process_payout', array(__CLASS__, 'process_payout'));
add_action('admin_post_wpdd_bulk_payouts', array(__CLASS__, 'process_bulk_payouts'));
+ add_action('admin_post_wpdd_process_payout_request', array(__CLASS__, 'process_payout_request'));
+ add_action('admin_post_wpdd_reject_payout_request', array(__CLASS__, 'reject_payout_request'));
+ add_action('admin_post_wpdd_manual_payout', array(__CLASS__, 'process_manual_payout'));
+ add_action('admin_post_wpdd_adjust_balance', array(__CLASS__, 'adjust_creator_balance'));
add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
}
@@ -50,6 +54,15 @@ class WPDD_Admin_Payouts {
$currency = get_option('wpdd_currency', 'USD');
$threshold = floatval(get_option('wpdd_payout_threshold', 0));
+ // Get payout requests (requested status)
+ $payout_requests = $wpdb->get_results(
+ "SELECT p.*, u.display_name, u.user_email
+ FROM {$wpdb->prefix}wpdd_payouts p
+ INNER JOIN {$wpdb->users} u ON p.creator_id = u.ID
+ WHERE p.status = 'requested'
+ ORDER BY p.created_at ASC"
+ );
+
// Get payout history
$query = "SELECT p.*, u.display_name, u.user_email
FROM {$wpdb->prefix}wpdd_payouts p
@@ -81,9 +94,172 @@ class WPDD_Admin_Payouts {
@@ -432,4 +608,241 @@ class WPDD_Admin_Payouts {
return false;
}
}
+
+ public static function process_payout_request() {
+ if (!current_user_can('manage_options')) {
+ wp_die(__('You do not have permission to perform this action.', 'wp-digital-download'));
+ }
+
+ $payout_id = isset($_POST['payout_id']) ? intval($_POST['payout_id']) : 0;
+
+ if (!$payout_id || !wp_verify_nonce($_POST['wpdd_nonce'], 'wpdd_process_payout_request_' . $payout_id)) {
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=error'));
+ exit;
+ }
+
+ global $wpdb;
+
+ // Get the payout request
+ $payout = $wpdb->get_row($wpdb->prepare(
+ "SELECT * FROM {$wpdb->prefix}wpdd_payouts WHERE id = %d AND status = 'requested'",
+ $payout_id
+ ));
+
+ if (!$payout) {
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=error'));
+ exit;
+ }
+
+ // Process via PayPal API
+ $result = WPDD_PayPal_Payouts::process_payout($payout_id);
+
+ if ($result['success']) {
+ // Update payout status
+ $wpdb->update(
+ $wpdb->prefix . 'wpdd_payouts',
+ array(
+ 'status' => 'completed',
+ 'transaction_id' => $result['transaction_id'],
+ 'processed_by' => get_current_user_id(),
+ 'processed_at' => current_time('mysql')
+ ),
+ array('id' => $payout_id),
+ array('%s', '%s', '%d', '%s'),
+ array('%d')
+ );
+
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=success'));
+ } else {
+ // Update with error
+ $wpdb->update(
+ $wpdb->prefix . 'wpdd_payouts',
+ array(
+ 'status' => 'failed',
+ 'notes' => $result['error']
+ ),
+ array('id' => $payout_id),
+ array('%s', '%s'),
+ array('%d')
+ );
+
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=error'));
+ }
+ exit;
+ }
+
+ public static function reject_payout_request() {
+ if (!current_user_can('manage_options')) {
+ wp_die(__('You do not have permission to perform this action.', 'wp-digital-download'));
+ }
+
+ $payout_id = isset($_POST['payout_id']) ? intval($_POST['payout_id']) : 0;
+
+ if (!$payout_id || !wp_verify_nonce($_POST['wpdd_nonce'], 'wpdd_reject_payout_request_' . $payout_id)) {
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=error'));
+ exit;
+ }
+
+ global $wpdb;
+
+ // Get the payout request
+ $payout = $wpdb->get_row($wpdb->prepare(
+ "SELECT * FROM {$wpdb->prefix}wpdd_payouts WHERE id = %d AND status = 'requested'",
+ $payout_id
+ ));
+
+ if (!$payout) {
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=error'));
+ exit;
+ }
+
+ // Update status to failed/rejected
+ $wpdb->update(
+ $wpdb->prefix . 'wpdd_payouts',
+ array(
+ 'status' => 'failed',
+ 'notes' => 'Request rejected by administrator',
+ 'processed_by' => get_current_user_id(),
+ 'processed_at' => current_time('mysql')
+ ),
+ array('id' => $payout_id),
+ array('%s', '%s', '%d', '%s'),
+ array('%d')
+ );
+
+ // Restore balance to creator
+ update_user_meta($payout->creator_id, 'wpdd_creator_balance', $payout->amount);
+
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-payouts&message=success'));
+ exit;
+ }
+
+ public static function process_manual_payout() {
+ if (!current_user_can('manage_options') ||
+ !wp_verify_nonce($_POST['wpdd_nonce'], 'wpdd_manual_payout')) {
+ wp_die(__('Security check failed', 'wp-digital-download'));
+ }
+
+ $creator_id = intval($_POST['creator_id']);
+ $amount = floatval($_POST['payout_amount']);
+ $reason = sanitize_textarea_field($_POST['payout_reason']);
+
+ if (!$creator_id || $amount <= 0) {
+ wp_redirect(add_query_arg('message', 'error', wp_get_referer()));
+ exit;
+ }
+
+ $creator = get_userdata($creator_id);
+ if (!$creator || !in_array('wpdd_creator', $creator->roles)) {
+ wp_redirect(add_query_arg('message', 'error', wp_get_referer()));
+ exit;
+ }
+
+ $paypal_email = get_user_meta($creator_id, 'wpdd_paypal_email', true);
+ if (empty($paypal_email)) {
+ wp_redirect(add_query_arg('message', 'error', wp_get_referer()));
+ exit;
+ }
+
+ global $wpdb;
+
+ // Create the payout record
+ $result = $wpdb->insert(
+ $wpdb->prefix . 'wpdd_payouts',
+ array(
+ 'creator_id' => $creator_id,
+ 'amount' => $amount,
+ 'currency' => get_option('wpdd_currency', 'USD'),
+ 'paypal_email' => $paypal_email,
+ 'status' => 'pending',
+ 'payout_method' => 'manual',
+ 'notes' => $reason,
+ 'created_at' => current_time('mysql'),
+ 'processed_by' => get_current_user_id()
+ ),
+ array('%d', '%f', '%s', '%s', '%s', '%s', '%s', '%s', '%d')
+ );
+
+ if (!$result) {
+ wp_redirect(add_query_arg('message', 'error', wp_get_referer()));
+ exit;
+ }
+
+ $payout_id = $wpdb->insert_id;
+
+ // Try to process via PayPal
+ if (class_exists('WPDD_PayPal_Payouts')) {
+ $paypal_result = WPDD_PayPal_Payouts::process_payout($payout_id);
+
+ if (!$paypal_result) {
+ // Update status to failed
+ $wpdb->update(
+ $wpdb->prefix . 'wpdd_payouts',
+ array('status' => 'failed'),
+ array('id' => $payout_id),
+ array('%s'),
+ array('%d')
+ );
+ }
+ }
+
+ wp_redirect(add_query_arg('message', 'success', wp_get_referer()));
+ exit;
+ }
+
+ public static function adjust_creator_balance() {
+ if (!current_user_can('manage_options') ||
+ !wp_verify_nonce($_POST['wpdd_nonce'], 'wpdd_adjust_balance')) {
+ wp_die(__('Security check failed', 'wp-digital-download'));
+ }
+
+ $creator_id = intval($_POST['creator_id']);
+ $adjustment_type = sanitize_text_field($_POST['adjustment_type']);
+ $amount = floatval($_POST['adjustment_amount']);
+ $reason = sanitize_textarea_field($_POST['adjustment_reason']);
+
+ if (!$creator_id || $amount <= 0 || !in_array($adjustment_type, array('add', 'subtract'))) {
+ wp_redirect(add_query_arg('message', 'error', wp_get_referer()));
+ exit;
+ }
+
+ $creator = get_userdata($creator_id);
+ if (!$creator || !in_array('wpdd_creator', $creator->roles)) {
+ wp_redirect(add_query_arg('message', 'error', wp_get_referer()));
+ exit;
+ }
+
+ // Get current balance
+ $current_balance = floatval(get_user_meta($creator_id, 'wpdd_balance', true));
+
+ // Calculate new balance
+ if ($adjustment_type === 'add') {
+ $new_balance = $current_balance + $amount;
+ } else {
+ $new_balance = max(0, $current_balance - $amount); // Don't allow negative balance
+ }
+
+ // Update the balance
+ update_user_meta($creator_id, 'wpdd_balance', $new_balance);
+
+ // Create a record of this adjustment
+ global $wpdb;
+ $wpdb->insert(
+ $wpdb->prefix . 'wpdd_balance_adjustments',
+ array(
+ 'creator_id' => $creator_id,
+ 'adjustment_type' => $adjustment_type,
+ 'amount' => $amount,
+ 'previous_balance' => $current_balance,
+ 'new_balance' => $new_balance,
+ 'reason' => $reason,
+ 'adjusted_by' => get_current_user_id(),
+ 'created_at' => current_time('mysql')
+ ),
+ array('%d', '%s', '%f', '%f', '%f', '%s', '%d', '%s')
+ );
+
+ wp_redirect(add_query_arg('message', 'balance_adjusted', wp_get_referer()));
+ exit;
+ }
}
\ No newline at end of file
diff --git a/admin/class-wpdd-admin.php b/admin/class-wpdd-admin.php
index 7ef9d78..db27ba9 100644
--- a/admin/class-wpdd-admin.php
+++ b/admin/class-wpdd-admin.php
@@ -12,6 +12,7 @@ class WPDD_Admin {
add_action('manage_wpdd_product_posts_custom_column', array(__CLASS__, 'render_product_columns'), 10, 2);
add_filter('manage_edit-wpdd_product_sortable_columns', array(__CLASS__, 'make_columns_sortable'));
add_action('pre_get_posts', array(__CLASS__, 'sort_products_by_column'));
+ add_action('pre_get_posts', array(__CLASS__, 'filter_creator_products'));
add_action('admin_init', array(__CLASS__, 'handle_admin_actions'));
// Initialize admin payouts
@@ -21,41 +22,70 @@ class WPDD_Admin {
}
public static function add_admin_menus() {
- add_submenu_page(
- 'edit.php?post_type=wpdd_product',
- __('Orders', 'wp-digital-download'),
- __('Orders', 'wp-digital-download'),
- 'wpdd_manage_orders',
- 'wpdd-orders',
- array(__CLASS__, 'render_orders_page')
- );
+ // Show different menus based on user role
+ $user = wp_get_current_user();
+ $is_creator = in_array('wpdd_creator', (array) $user->roles);
+ $is_admin = current_user_can('manage_options');
- add_submenu_page(
- 'edit.php?post_type=wpdd_product',
- __('Reports', 'wp-digital-download'),
- __('Reports', 'wp-digital-download'),
- 'wpdd_view_reports',
- 'wpdd-reports',
- array(__CLASS__, 'render_reports_page')
- );
+ if ($is_admin) {
+ // Full admin menus
+ add_submenu_page(
+ 'edit.php?post_type=wpdd_product',
+ __('Orders', 'wp-digital-download'),
+ __('Orders', 'wp-digital-download'),
+ 'wpdd_manage_orders',
+ 'wpdd-orders',
+ array(__CLASS__, 'render_orders_page')
+ );
+
+ add_submenu_page(
+ 'edit.php?post_type=wpdd_product',
+ __('Reports', 'wp-digital-download'),
+ __('Reports', 'wp-digital-download'),
+ 'wpdd_view_reports',
+ 'wpdd-reports',
+ array(__CLASS__, 'render_reports_page')
+ );
+
+ add_submenu_page(
+ 'edit.php?post_type=wpdd_product',
+ __('Customers', 'wp-digital-download'),
+ __('Customers', 'wp-digital-download'),
+ 'wpdd_manage_orders',
+ 'wpdd-customers',
+ array(__CLASS__, 'render_customers_page')
+ );
+
+ add_submenu_page(
+ 'edit.php?post_type=wpdd_product',
+ __('Shortcodes', 'wp-digital-download'),
+ __('Shortcodes', 'wp-digital-download'),
+ 'edit_wpdd_products',
+ 'wpdd-shortcodes',
+ array(__CLASS__, 'render_shortcodes_page')
+ );
+ }
- add_submenu_page(
- 'edit.php?post_type=wpdd_product',
- __('Customers', 'wp-digital-download'),
- __('Customers', 'wp-digital-download'),
- 'wpdd_manage_orders',
- 'wpdd-customers',
- array(__CLASS__, 'render_customers_page')
- );
-
- add_submenu_page(
- 'edit.php?post_type=wpdd_product',
- __('Shortcodes', 'wp-digital-download'),
- __('Shortcodes', 'wp-digital-download'),
- 'edit_wpdd_products',
- 'wpdd-shortcodes',
- array(__CLASS__, 'render_shortcodes_page')
- );
+ if ($is_creator || $is_admin) {
+ // Creator-specific menus
+ add_submenu_page(
+ 'edit.php?post_type=wpdd_product',
+ __('My Sales', 'wp-digital-download'),
+ __('My Sales', 'wp-digital-download'),
+ 'wpdd_view_own_sales',
+ 'wpdd-creator-sales',
+ array(__CLASS__, 'render_creator_sales_page')
+ );
+
+ add_submenu_page(
+ 'edit.php?post_type=wpdd_product',
+ __('My Payouts', 'wp-digital-download'),
+ __('My Payouts', 'wp-digital-download'),
+ 'wpdd_view_own_sales',
+ 'wpdd-creator-payouts',
+ array(__CLASS__, 'render_creator_payouts_page')
+ );
+ }
}
public static function add_product_columns($columns) {
@@ -917,4 +947,289 @@ class WPDD_Admin {
is_main_query()) {
+ return;
+ }
+
+ if (!isset($_GET['post_type']) || $_GET['post_type'] !== 'wpdd_product') {
+ return;
+ }
+
+ $user = wp_get_current_user();
+ $is_creator = in_array('wpdd_creator', (array) $user->roles);
+ $is_admin = current_user_can('manage_options');
+
+ // Only filter for creators, not admins
+ if ($is_creator && !$is_admin) {
+ $query->set('author', get_current_user_id());
+ }
+ }
+
+ public static function render_creator_sales_page() {
+ global $wpdb;
+
+ $user_id = get_current_user_id();
+ $currency = get_option('wpdd_currency', 'USD');
+ $commission_rate = floatval(get_option('wpdd_commission_rate', 0));
+
+ // Get creator's sales data
+ $sales = $wpdb->get_results($wpdb->prepare(
+ "SELECT o.*, p.post_title as product_name,
+ (o.total * %f / 100) as platform_fee,
+ (o.total * (100 - %f) / 100) as creator_earning
+ FROM {$wpdb->prefix}wpdd_orders o
+ INNER JOIN {$wpdb->posts} p ON o.product_id = p.ID
+ WHERE p.post_author = %d
+ AND o.status = 'completed'
+ ORDER BY o.purchase_date DESC
+ LIMIT 100",
+ $commission_rate,
+ $commission_rate,
+ $user_id
+ ));
+
+ // Get totals
+ $total_sales = $wpdb->get_var($wpdb->prepare(
+ "SELECT SUM(o.total)
+ FROM {$wpdb->prefix}wpdd_orders o
+ INNER JOIN {$wpdb->posts} p ON o.product_id = p.ID
+ WHERE p.post_author = %d
+ AND o.status = 'completed'",
+ $user_id
+ ));
+
+ $total_earnings = $total_sales * (1 - ($commission_rate / 100));
+ $current_balance = WPDD_Creator::get_creator_balance($user_id);
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+ purchase_date))); ?> |
+ product_name); ?> |
+ customer_name); ?> |
+ total, $currency); ?> |
+ platform_fee, $currency); ?> |
+ creator_earning, $currency); ?> |
+
+
+ status)); ?>
+
+ |
+
+
+
+
+
+
+
+
+
+ get_results($wpdb->prepare(
+ "SELECT * FROM {$wpdb->prefix}wpdd_payouts
+ WHERE creator_id = %d
+ ORDER BY created_at DESC
+ LIMIT 50",
+ $user_id
+ ));
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0) : ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+ created_at))); ?> |
+ amount, $payout->currency); ?> |
+ paypal_email); ?> |
+
+ '#fef3c7; color: #92400e;',
+ 'completed' => '#d1fae5; color: #065f46;',
+ 'failed' => '#fee2e2; color: #991b1b;',
+ 'requested' => '#dbeafe; color: #1e40af;'
+ );
+ $status_color = isset($status_colors[$payout->status]) ? $status_colors[$payout->status] : '#f3f4f6; color: #374151;';
+ ?>
+
+ status)); ?>
+
+ |
+ transaction_id ?: '-'); ?> |
+
+ processed_at
+ ? esc_html(date_i18n(get_option('date_format'), strtotime($payout->processed_at)))
+ : '-';
+ ?>
+ |
+
+
+
+
+
+
+
+
+
+ insert(
+ $wpdb->prefix . 'wpdd_payouts',
+ array(
+ 'creator_id' => $user_id,
+ 'amount' => $balance,
+ 'currency' => $currency,
+ 'paypal_email' => $paypal_email,
+ 'status' => 'requested',
+ 'payout_method' => 'request',
+ 'created_at' => current_time('mysql')
+ ),
+ array('%d', '%f', '%s', '%s', '%s', '%s', '%s')
+ );
+
+ // Reset balance to 0 since it's now requested
+ update_user_meta($user_id, 'wpdd_creator_balance', 0);
+
+ // Redirect to avoid resubmission
+ wp_redirect(admin_url('edit.php?post_type=wpdd_product&page=wpdd-creator-payouts&message=payout_requested'));
+ exit;
+ }
}
\ No newline at end of file
diff --git a/admin/class-wpdd-settings.php b/admin/class-wpdd-settings.php
index 07a729e..6240a4d 100644
--- a/admin/class-wpdd-settings.php
+++ b/admin/class-wpdd-settings.php
@@ -16,7 +16,7 @@ class WPDD_Settings {
'edit.php?post_type=wpdd_product',
__('Settings', 'wp-digital-download'),
__('Settings', 'wp-digital-download'),
- 'wpdd_manage_settings',
+ 'manage_options',
'wpdd-settings',
array(__CLASS__, 'render_settings_page')
);
@@ -26,9 +26,16 @@ class WPDD_Settings {
register_setting('wpdd_settings', 'wpdd_paypal_mode');
register_setting('wpdd_settings', 'wpdd_paypal_client_id');
register_setting('wpdd_settings', 'wpdd_paypal_secret');
+ register_setting('wpdd_settings', 'wpdd_paypal_payout_email');
register_setting('wpdd_settings', 'wpdd_admin_email');
register_setting('wpdd_settings', 'wpdd_from_name');
register_setting('wpdd_settings', 'wpdd_from_email');
+ register_setting('wpdd_settings', 'wpdd_smtp_enabled');
+ register_setting('wpdd_settings', 'wpdd_smtp_host');
+ register_setting('wpdd_settings', 'wpdd_smtp_port');
+ register_setting('wpdd_settings', 'wpdd_smtp_username');
+ register_setting('wpdd_settings', 'wpdd_smtp_password');
+ register_setting('wpdd_settings', 'wpdd_smtp_encryption');
register_setting('wpdd_settings', 'wpdd_currency');
register_setting('wpdd_settings', 'wpdd_enable_guest_checkout');
register_setting('wpdd_settings', 'wpdd_default_download_limit');
@@ -193,6 +200,18 @@ class WPDD_Settings {
'wpdd_paypal_settings',
array('name' => 'wpdd_paypal_secret')
);
+
+ add_settings_field(
+ 'wpdd_paypal_payout_email',
+ __('PayPal Payout Account Email', 'wp-digital-download'),
+ array(__CLASS__, 'email_field'),
+ 'wpdd_settings',
+ 'wpdd_paypal_settings',
+ array(
+ 'name' => 'wpdd_paypal_payout_email',
+ 'description' => __('PayPal account email that will send payouts to creators', 'wp-digital-download')
+ )
+ );
}
private static function add_email_fields() {
@@ -231,6 +250,94 @@ class WPDD_Settings {
'description' => __('Email address shown in email headers', 'wp-digital-download')
)
);
+
+ add_settings_field(
+ 'wpdd_smtp_enabled',
+ __('Enable SMTP', 'wp-digital-download'),
+ array(__CLASS__, 'checkbox_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array(
+ 'name' => 'wpdd_smtp_enabled',
+ 'label' => __('Use SMTP for sending emails instead of PHP mail()', 'wp-digital-download')
+ )
+ );
+
+ add_settings_field(
+ 'wpdd_smtp_host',
+ __('SMTP Host', 'wp-digital-download'),
+ array(__CLASS__, 'text_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array(
+ 'name' => 'wpdd_smtp_host',
+ 'description' => __('SMTP server hostname (e.g., smtp.gmail.com)', 'wp-digital-download')
+ )
+ );
+
+ add_settings_field(
+ 'wpdd_smtp_port',
+ __('SMTP Port', 'wp-digital-download'),
+ array(__CLASS__, 'number_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array(
+ 'name' => 'wpdd_smtp_port',
+ 'description' => __('SMTP server port number (common ports: 25, 465, 587)', 'wp-digital-download'),
+ 'min' => 1,
+ 'max' => 65535
+ )
+ );
+
+ add_settings_field(
+ 'wpdd_smtp_encryption',
+ __('SMTP Encryption', 'wp-digital-download'),
+ array(__CLASS__, 'select_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array(
+ 'name' => 'wpdd_smtp_encryption',
+ 'options' => array(
+ '' => __('None', 'wp-digital-download'),
+ 'tls' => __('TLS', 'wp-digital-download'),
+ 'ssl' => __('SSL', 'wp-digital-download')
+ ),
+ 'description' => __('Select encryption method - TLS is recommended for most providers', 'wp-digital-download')
+ )
+ );
+
+ add_settings_field(
+ 'wpdd_smtp_autodetect',
+ __('Auto-Detect Settings', 'wp-digital-download'),
+ array(__CLASS__, 'smtp_autodetect_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array()
+ );
+
+ add_settings_field(
+ 'wpdd_smtp_username',
+ __('SMTP Username', 'wp-digital-download'),
+ array(__CLASS__, 'text_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array(
+ 'name' => 'wpdd_smtp_username',
+ 'description' => __('SMTP authentication username', 'wp-digital-download')
+ )
+ );
+
+ add_settings_field(
+ 'wpdd_smtp_password',
+ __('SMTP Password', 'wp-digital-download'),
+ array(__CLASS__, 'password_field'),
+ 'wpdd_settings',
+ 'wpdd_email_settings',
+ array(
+ 'name' => 'wpdd_smtp_password',
+ 'description' => __('SMTP authentication password', 'wp-digital-download')
+ )
+ );
}
private static function add_download_fields() {
@@ -305,59 +412,101 @@ class WPDD_Settings {
}
public static function render_settings_page() {
+ $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'general';
?>
-