📝 pdf_bbcode_project_checkpoint_v2.md

PDF BBCode Mod — Project Checkpoint (v2, supersedes earlier checkpoint)

Forum: drugs-and-users.org (self-hosted SMF). Dev box: 192.168.233.129, /var/www/html. Two branches in play: live SMF 2.0.19 (primary, confirmed fully working as of v2.16) and a separate SMF 2.1 test install at /var/www/html/smf21 (paused, several open items below).

Mod name: pdf_bbcode (class PDFBBCode, file PDFBBC.php). Adds a [pdf][/pdf] BBCode tag rendering a self-hosted Mozilla PDF.js viewer, plus a per-post opt-in toggle ([pdf=autodisplay][/pdf] / [pdf=noautodisplay][/pdf], default off) for auto-embedding every .pdf attachment on that post with no ID needed. Fully separate from an old, abandoned package-manager mod line (Duncan85:PDF_Tag) — that lineage is dead, ignore it entirely.

Current shipped version: v2.16 (naming convention: dot, not underscore — pdf_bbcode_v2.16.zip).


Files/components — status and whether to use

File Status Use it?
PDFBBC.php Working, current. Holds validateUrl (URL form), validateAttachment (ID form + auto-detect + autodisplay/noautodisplay toggle), findPdfAttachment(), currentMsgId() (new, replaces dead mechanism), shouldAutoDisplay() (new), button() (rewritten for cross-branch safety, untested on 2.1) Yes — current base
package-info.xml Two <install> blocks: 1.0 - 2.0.99 (code-based hook registration + <modification> reference) and 2.1 - 2.1.99 (declarative <hook> tags, 2.1-only, <file> auto-embed patch NOT yet added to this block — see open items) Yes
pdf_register.php / pdf_unregister.php 2.0.x-only, code-action hook registration. Dead integrate_pre_parsebbc step already fully removed Yes
pdf_display_patch.xml Separate <modification>-rooted file (required — SMF rejects inline <file> ops directly under <install>). Flags is_pdf + carries pdf_id_msg through in Display.php's native attachment loop; echoes PDF.js iframe in Display.template.php only if PDFBBCode::shouldAutoDisplay($attachment['pdf_id_msg']) returns true Yes
pdfjs/ (self-hosted PDF.js) viewer.mjs hand-edited: scrollModeOnLoad changed -13 (ScrollMode.PAGE) for single-page/scrollable display Yes, don't revert
pdf_bbcode.english.php, pdf.gif No known issues Yes
readme.txt User-facing usage doc. Needs updating to reflect v2.16's real feature set (toggle tags, revived auto-detect) — not yet updated this session Update before next distribution

Verified facts — don't re-check


Open items — decisions, not blockers


Next actual action

Resume SMF 2.1 work: install v2.16 fresh on /var/www/html/smf21 (full clean install, not a file-swap, since the button fix and toggle mechanism are structural), then retest in this order:

  1. Does the [pdf] toolbar button now appear (verifies the button() row-append fix)?
  2. Does [pdf]https://.../file.pdf[/pdf] (plain URL form) render correctly?
  3. Diagnose the still-open "empty [pdf][/pdf] vanishes" bug — start by checking 2.1's actual BBC-tag regex/matching code for unparsed_content types to see if it requires non-empty content.