The importer, for developers

This manual is for LMS Blueprint 0.47.19

Core Complete 0.47.0

What the importer accepts, where it keeps its work, its limits, and the two hooks that let other code offer suggestions while a course comes in. For importing a course on screen, and every message the importer shows, see Bring a course in.

What it accepts

  • File types: .html, .htm, .zip (a folder of lessons), .md and .docx. Markdown and Word files are turned into HTML first, then go through the same steps.
  • In a folder, files named nav, navigation, menu, header, footer, sidebar, toc or contents (.html or .htm) are not treated as lessons.
  • In a Word file, any single part larger than 32 MB is refused.
  • What crosses: headings, paragraphs, lists, quotes, figures, images, tables and rules, with inline text styling and links. Scripts, styles, navigation and form controls are not carried. The exact lists are the KEEP, INLINE, UNWRAP and RETIRE constants in modules/importer/includes/class-cb-import-strip.php.
  • Hidden answers: a quiz built from plain page elements, a flip card, or a feedback panel the page keeps hidden until the learner answers is held back until the author chooses: make it a quiz (quiz, for quizzes only), keep it as text (text) or leave it out (leave). Until then the import stops with V-I10. An answer key comes only from the source: an option marked data-correct, or a checked control.

Who can import, and where the work is kept

  • Importing needs the capability import_lmsb_courses, which is given to administrators.
  • Each import is a job, kept as a post of type lmsb_import.
  • Jobs are kept for 7 days. A daily scheduled event, lmsb_import_cleanup, clears older ones.
  • A folder is written up to 5 lessons per request, and the job is saved after each, so a request that stops part-way loses at most the lesson it was on.

Lessons and courses the importer writes are drafts. Your own AI agent can run the same import through agent access; see Connect your own AI agent.

Offering suggestions: two hooks

While a course is being reviewed, the importer can show suggestions for each lesson. The AI add-on provides them, but any plugin can.

lmsb_import_review_panels (action)

Where a suggestions panel is drawn. It runs on step 3 (where the lesson text is) and step 4 (what will cross), and passes the step, the job ID, the job and a context array (key, title, cached, folder, labels).

When nothing is hooked to it, step 4 shows one line instead, “Get suggestions with LMS Blueprint AI.” Hooking anything to this action counts as a suggestions add-on being present.

lmsb_import_propose (filter)

Returns the proposals for one lesson. It receives null and the lesson’s context, with the raw HTML taken out, and returns an array of proposals or a WP_Error, whose message is shown.

Every proposal is checked by the importer, whoever made it:

  • its kind must be one of region, break, form, workbook, glossary or split;
  • its words must be copied exactly from the lesson, apart from spacing;
  • nothing shaped like a quiz answer is allowed.

A proposal that fails is dropped and counted, never shown, and no text the proposer wrote reaches the screen: only the lesson’s own words, under the importer’s labels. Proposals are kept in the job, per lesson, so reopening the screen doesn’t ask again.