Duplicate Snippet
Embed Snippet on Your Site
Charitable Email Preview Debug Tool
Code Preview
php
';
// 3. Conflicts
echo '';
// 4. URL Testing
echo '';
// 5. Live Preview Test (if this IS a preview request)
if ( isset( $_GET['charitable_action'] ) && $_GET['charitable_action'] === 'preview_email' && isset( $_GET['email_id'] ) ) {
echo '';
}
$report_text = implode( "\n", $report_lines );
?>
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
3. Potential Conflicts
'; $current_theme = wp_get_theme(); charitable_debug_display_info( 'Active Theme', $current_theme->get( 'Name' ), false ); $problematic = array( 'safe-redirect-manager' => 'Safe Redirect Manager - HIGH RISK', 'ninja-firewall' => 'NinjaFirewall - HIGH RISK', 'really-simple-security' => 'Really Simple Security - MEDIUM RISK', 'wp-rocket' => 'WP Rocket - LOW RISK', ); $active_plugins = get_option( 'active_plugins', array() ); $conflicts = array(); foreach ( $active_plugins as $plugin ) { foreach ( $problematic as $slug => $name ) { if ( stripos( $plugin, $slug ) !== false ) { $conflicts[] = $name; echo '⚠️ ' . esc_html( $name ) . '
';
}
}
}
if ( empty( $conflicts ) ) {
charitable_debug_display_test( 'Plugin Conflicts', true, 'No known problematic plugins detected' );
} else {
charitable_debug_display_test( 'Plugin Conflicts', false, implode( "\n", $conflicts ) );
}
echo '4. URL Testing
'; $test_url = add_query_arg( array( 'charitable_action' => 'preview_email', 'email_id' => 'offline_donation_receipt', ), home_url() ); charitable_debug_display_info( 'Generated Preview URL', $test_url, false ); $url_issues = array(); if ( strpos( $test_url, '//?' ) !== false ) { $url_issues[] = 'Double slash detected'; } if ( ! parse_url( $test_url, PHP_URL_SCHEME ) ) { $url_issues[] = 'Missing URL scheme'; } charitable_debug_display_test( 'URL Generation', empty( $url_issues ), implode( ', ', $url_issues ) ); echo '🧪 LIVE TEST: Click to Test Preview URL
'; echo 'This should show email preview, NOT redirect to homepage
'; echo '5. Live Preview Test Results
'; $email_id = sanitize_text_field( wp_unslash( $_GET['email_id'] ) ); charitable_debug_display_info( 'Email ID Received', $email_id, false ); if ( $emails_helper ) { $email_class = $emails_helper->get_email( $email_id ); charitable_debug_display_test( 'Email Class Found', (bool) $email_class, $email_class ?: 'Not found' ); if ( $email_class && class_exists( $email_class ) ) { $email_obj = new $email_class(); charitable_debug_display_test( 'Email Object Created', true, 'Name: ' . $email_obj->get_name() ); echo '📧 Email Preview Content:
'; echo '';
echo $email_obj->preview(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '
';
} else {
charitable_debug_display_test( 'Email Object Created', false, 'Class not found or invalid' );
}
}
echo '📋 COPY THIS REPORT
Instructions:
- Select all text in the box below (Ctrl+A or Cmd+A)
- Copy it (Ctrl+C or Cmd+C)
- Test the Preview URL button above – note what happens
- Paste the report + test results in your support ticket