📝 pdf_bbcode_final_checkpoint.md

PDF BBCode Mod — Checkpoint (v2.22, 2026-07-29)

Paste this whole file into a fresh chat to resume. Project: SMF mod (PDFBBCode class, PDFBBC.php) that adds a [pdf] BBCode tag rendering PDFs via a self-hosted, client-side Mozilla PDF.js viewer in an iframe — plain URL form, attachment-ID form, and per-post autodisplay toggle. Zero core-file edits; everything goes through SMF's own integration hooks (2.1.x) or an install-time hook-registration script (2.0.x, which has no hook auto-loading).

Files / components

File Status Use it?
PDFBBC.php v2.22 — single validatePDF() entry point dispatching to validateUrl/validateAttachment by is_array($data). Debug scaffolding (unconditional error_log, [PDFBBC DEBUG: ...] messages) was flagged for removal but never confirmed stripped — check before calling this clean. Yes — current live file
package-info.xml v2.22 — 2.1 block now includes pdf_display_patch_21.xml; 2.0.x block untouched Yes
pdf_display_patch_21.xml New this session. Patches Subs-Attachments.php's loadAttachmentContext() (adds is_pdf) + Display.template.php (echoes the iframe when shouldAutoDisplay() is true) Yes — 2.1.x only
pdf_display_patch.xml Original, 2.0.x-only. Patches Display.php directly (fork-specific anchor, doesn't exist on stock 2.1) Yes — 2.0.x only, unchanged
pdf_register.php / pdf_unregister.php 2.0.x hook registration via install-time code action Yes, unchanged
pdf.gif / pdf.png Toolbar icons — .png required on 2.1 (SCEditor CSS hardcodes it), .gif for 2.0.x Yes, unchanged
pdfjs/ dir Bundled PDF.js viewer + its own .htaccess for .mjs/.wasm/.map MIME types Yes, unchanged
pdf_bbcode.english.php Language strings Yes, unchanged
readme.txt Rewritten this session — fixed a stray ] typo, documents the "2.1.x needs filler content between tags" quirk Yes — current
test_harness.php Standalone CLI script, calls validatePDF() directly bypassing SMF's parser entirely. Diagnostic only — not part of the shipped package Keep for future debugging, don't ship
Duncan85:PDF_Tag (old mod line) Dead, abandoned, unrelated lineage — checked and ruled out as a suspect this session No — ignore entirely

Verified facts — don't re-check

Open items (decisions, not blockers)

Next actual action

None outstanding — v2.22 is confirmed working on both live branches; this checkpoint is being archived to the forum post to close out the thread. If resuming, start with: confirm whether the debug-scaffolding strip (above) was done, and if not, do that before calling this build genuinely "clean."