diff --git a/includes/Core/Notifications/EmailManager.php b/includes/Core/Notifications/EmailManager.php index 9a6b797..1eb6643 100644 --- a/includes/Core/Notifications/EmailManager.php +++ b/includes/Core/Notifications/EmailManager.php @@ -361,11 +361,20 @@ class EmailManager { private function is_event_enabled($event_id, $channel_id, $recipient_type) { $settings = get_option('woonoow_notification_settings', []); - // Check if event exists and channel is enabled + // Check if event exists and channel is configured if (isset($settings['events'][$event_id]['channels'][$channel_id])) { return $settings['events'][$event_id]['channels'][$channel_id]['enabled'] ?? false; } + // Default: enable email notifications if not explicitly configured + // This allows the plugin to work out-of-the-box with default templates + if ($channel_id === 'email') { + if (defined('WP_DEBUG') && WP_DEBUG) { + error_log('[EmailManager] Event not configured, using default: enabled'); + } + return true; // Enable by default + } + return false; } diff --git a/includes/Core/Notifications/EmailRenderer.php b/includes/Core/Notifications/EmailRenderer.php index a7a8a05..e8383d3 100644 --- a/includes/Core/Notifications/EmailRenderer.php +++ b/includes/Core/Notifications/EmailRenderer.php @@ -81,13 +81,20 @@ class EmailRenderer { * @return array|null */ private function get_template_settings($event_id, $recipient_type) { - // Get saved template - $template = TemplateProvider::get_template($event_id, 'email'); + // Get saved template (with recipient_type for proper default template lookup) + $template = TemplateProvider::get_template($event_id, 'email', $recipient_type); if (!$template) { + if (defined('WP_DEBUG') && WP_DEBUG) { + error_log('[EmailRenderer] No template found for event: ' . $event_id . ', recipient: ' . $recipient_type); + } return null; } + if (defined('WP_DEBUG') && WP_DEBUG) { + error_log('[EmailRenderer] Template found - Subject: ' . ($template['subject'] ?? 'no subject')); + } + // Get design template preference $settings = get_option('woonoow_notification_settings', []); $design = $settings['email_design_template'] ?? 'modern';