sensei
sensei copied to clipboard
Learning mode template is broken when trying to edit it through the lesson editor
Steps to Reproduce
- Install and activate a theme that is not a block theme. Example: Divi.
- In the sidebar, select the Learning Mode template.
- Click on "Edit".
What I Expected
To be able to edit the template.
What Happened Instead
The template is broken because the blocks are not registered.
Questions
Notice that we can only edit the template there if it's not a block theme. Should it also work there for block themes? And should the user be able to change the template there since Learning Mode forces a specific template?
PHP / WordPress / Sensei LMS version
Tested on WordPress 6..5 and 6.7 / Sensei LMS 4.24.5
Browser / OS version
Chrome / Mac OS
Screenshot / Video
https://github.com/user-attachments/assets/263df4d1-c4de-4073-bfaf-dcd559b7cc6d
Context / Source
I think the ideal solution here wouldn't be to restrict where the blocks are registered or not. The ideal solution in my opinion would be to re-think the lesson/template blocks to be the same. It would help to avoid confusion for the users, and this issue wouldn't happen since the blocks should be available on lessons and in the Learning Mode template.
Related PR: https://github.com/Automattic/sensei/pull/7791
I just encountered this too, while testing the process for creating a new template.
You can edit the template via Appearance > Editor, but not via the lesson itself.
Note: In my test, when editing a lesson, the template used was "Single Posts". Not sure if that's correct, as it should use the Learning mode template if learning mode is enabled.