fix: PHP errors and clean up error_log statements
- Fixed redirect_wc_pages_to_spa: added spa_mode check (only redirect when 'full') - Fixed PHP fatal error: use get_queried_object() instead of global $product - Removed all error_log debug statements from codebase - Fixed broken syntax in PaymentGatewaysProvider.php after error_log removal
This commit is contained in:
@@ -119,7 +119,6 @@ class EmailManager {
|
||||
*/
|
||||
public function send_order_processing_email($order_id, $order = null) {
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] send_order_processing_email triggered for order #' . $order_id);
|
||||
}
|
||||
|
||||
if (!$order) {
|
||||
@@ -128,7 +127,6 @@ class EmailManager {
|
||||
|
||||
if (!$order) {
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] Order not found for ID: ' . $order_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -136,13 +134,11 @@ class EmailManager {
|
||||
// Check if event is enabled
|
||||
if (!$this->is_event_enabled('order_processing', 'email', 'customer')) {
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] order_processing email is disabled in settings');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] Sending order_processing email for order #' . $order_id);
|
||||
}
|
||||
|
||||
// Send email
|
||||
@@ -397,7 +393,6 @@ class EmailManager {
|
||||
|
||||
if (!$email) {
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] Password reset email rendering failed for user: ' . $user->user_login);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -411,7 +406,6 @@ class EmailManager {
|
||||
$sent = wp_mail($email['to'], $email['subject'], $email['body'], $headers);
|
||||
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] Password reset email sent to ' . $email['to'] . ' - Result: ' . ($sent ? 'success' : 'failed'));
|
||||
}
|
||||
|
||||
// Log email sent
|
||||
@@ -484,7 +478,6 @@ class EmailManager {
|
||||
// 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
|
||||
}
|
||||
@@ -502,7 +495,6 @@ class EmailManager {
|
||||
*/
|
||||
private function send_email($event_id, $recipient_type, $data, $extra_data = []) {
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] send_email called - Event: ' . $event_id . ', Recipient: ' . $recipient_type);
|
||||
}
|
||||
|
||||
// Get email renderer
|
||||
@@ -513,13 +505,11 @@ class EmailManager {
|
||||
|
||||
if (!$email) {
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] Email rendering failed for event: ' . $event_id);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] Email rendered successfully - To: ' . $email['to'] . ', Subject: ' . $email['subject']);
|
||||
}
|
||||
|
||||
// Send email via wp_mail
|
||||
@@ -531,7 +521,6 @@ class EmailManager {
|
||||
$sent = wp_mail($email['to'], $email['subject'], $email['body'], $headers);
|
||||
|
||||
if (defined('WP_DEBUG') && WP_DEBUG) {
|
||||
error_log('[EmailManager] wp_mail called - Result: ' . ($sent ? 'success' : 'failed'));
|
||||
}
|
||||
|
||||
// Log email sent
|
||||
|
||||
@@ -86,13 +86,11 @@ class EmailRenderer {
|
||||
|
||||
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
|
||||
|
||||
@@ -229,7 +229,6 @@ class PushNotificationHandler {
|
||||
self::queue_notification($subscription_id, $payload);
|
||||
$sent++;
|
||||
} catch (\Exception $e) {
|
||||
error_log('Push notification error: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user