Hello, I would like to know how to copy a h5p created on the content bank repository to a user's private file repository?
Reason - Private content bank is not supported at user context level, so my workaround is to automatically copy the h5p file into the current teacher-user's private file repository for his/her own private use after he/she creates or edits it using the content bank (+h5p plugin), while keeping the h5p file unlisted on the content bank.
I have identified the core file which needs to be edited:
/moodle/contentbank/contenttype/h5p/classes/form/editor.php
I have tried appending the below script but I think that is not the correct pathname of the user's private file repository? Do I have to call the file API and can someone kindly provide the code? The documentation does not provide guidance on how to create a file directly on a user's private files repository.
$file->copy_content_to($CFG->dirroot . $file->get_filename())
Thanks!