Details
-
Bug
-
Status: Reopened
-
Minor
-
Resolution: Unresolved
-
3.11.7, 4.0.1
-
None
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
mdl75042-311
-
mdl75042-400
-
mdl75042-master
-
Description
We found an embedded H5P content is sometimes not shown in the label activity.
Once the issue happens, we can fix the issue by saving label without any changes.
I investigated the issue, and found there is a cache for label, and showing the cached label.
This is not limited to H5P content, it applies to anything inside an iFrame inside the label HTML.
Reproduction steps:
- Have a test course with 1 participant
- Create a Page activity with any content. Note down the URL of this page
- Create a label activity
- In the label text select the Arrow dropdown to show the extra editing tools then select HTML to edit the raw html
5. Embed the page activity from step 2 in an iframe e.g.:
<p dir="ltr" style="text-align: left;"><br>
<iframe src="<URL FROM STEP 2>" style="width: 100%"></iframe>
</p>
6. In another tab / browser, 'Log in as' the participant in the course
7. Because you are logged in, embedded iFrames are disabled
8. Purge the caches php admin/cli/purge_caches.php
9. Refresh the page in the 'Log in as' tab, the iFrame will not display (as intended)
11. Switch to the normal tab, reload
12. The iFrame will not show either, because it has been cached as not visible (this is a bug)
13. Purge the caches again
14. On normal tab, reload and the iFrame will now be displayed
I have tested this same behaviour in other places such as Course section description, mod_assign intro and they do not exhibit this bug. It seems to only be in the moduleinfo, usually in an activity's intro html/text.
This is because mod_label is calling format_module_intro which is calling format_text and since you are in 'log in as' mode, $CFG->forceclean is true so it cleans the HTML, then caches it. The HTML is cleaned later on anyway, so the likely fix is to disable forceclean pre-cache then clean it AFTER caching it.