Skip to content

Duplicate Lesson Keeps Original Quiz ID #7890

@robertstaddon

Description

@robertstaddon

I'm running into a problems with lesson duplication that makes the duplicate feature unusable when lessons have quizzes. When a lesson containing a quiz is duplicated, the system correctly creates a new lesson and a new quiz, but the duplicated lesson’s quiz block still references the original quiz. As a result, any edits made to the quiz in the duplicated lesson—such as removing or adding questions—also affect the original lesson’s quiz, causing both lessons to share the same questions. This prevents users from safely duplicating a lesson and customizing its quiz without unintentionally modifying the original.

Steps to Reproduce

  1. Go to Lessons → All Lessons.
  2. Create or open a lesson that has a Quiz block with one or more questions, then save/publish.
    In the lesson list, use Duplicate on that lesson and confirm.
  3. Open the duplicated lesson (the new draft).
  4. In the Quiz block, remove all existing questions and add new questions (or change questions).
  5. Save/update the lesson.
  6. Open the original lesson and view its quiz.

What I Expected

  • The duplicated lesson has its own quiz. Editing or replacing questions in the duplicate should only affect that duplicate’s quiz.
  • The original lesson’s quiz and questions stay unchanged.

What Happened Instead

  • Changes made to the quiz in the duplicated lesson (e.g. deleting all questions and adding new ones) also appear on the original lesson’s quiz.
  • Both lessons end up sharing the same quiz/questions. The duplicate lesson’s quiz block appears to still reference the original quiz ID, so the duplicate feature cannot be used safely when the lesson has a quiz.

PHP / WordPress / Sensei LMS version

PHP 8.3, WordPress 6.9.1, Sensei LMS 4.25.2, Sensei Pro 1.24.5

Context / Source

We use lesson duplication to create variations of lessons (e.g. different difficulty or focus) and need different questions in each copy. Because editing the duplicated lesson’s quiz updates the original quiz, we can’t rely on the duplicate feature for lessons with quizzes, which creates extra work and risk.

From reviewing the plugin code, duplication does create a new quiz and link it to the new lesson, but the duplicated lesson’s post content still contains the quiz block with the original quiz ID. The block editor doesn’t update that ID when loading the duplicate, so saves can target the original quiz.

We’re asking that the duplicated lesson’s quiz block be updated to use the new quiz ID after duplication (and/or that there’s a supported way to “unlink” or create a fresh quiz for a lesson) so the duplicate feature works as expected.

Happy to provide more detail if needed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions