Use template on course creation

Maintained by Charles Fulton, Andrew Zito
This local plugin allows site administrators to create "template" courses which will be restored into new courses on course creation.
Price option: Free

Supports Moodle 3.1-5.2 See all versions
Latest release: 3 years ago
Installations: 337
Downloads (last 90 days): 160

Frankenstyle name: local_course_template
Local plugins

Comments

Product ratings and reviews are coming to Moodle Marketplace. Until then, existing comments remain available to read, but new posts have been disabled.

Hi Joanna, we've released a new vesrsion (3.6.2) that allows you to disable the caching behavior. That should clear up the problem that you're encountering.
Hi Joanna, we've released a new vesrsion (3.6.2) that allows you to disable the caching behavior. That should clear up the problem that you're encountering.
Hi Joanna, we've discussed this internally and determined that what you're seeing is the caching behavior. For now, you'll have to clear the cache in between each change. We recognize that this is less than ideal, so we're going to look at making the caching behavior more intelligent.
Hi Andrew, yes that's right. I found that I could create the template + save. Make changes to the template + save. Use the template to successfully create course 1. If I then modified the template and created course 2, it did not contain the changes I had just made and instead delivered me the same template as was served for course 1. It seemed as soon as the template was used once, it no longer reflected any subsequent changes.
Hi Joanna, it is the case that courses created based on the template will not be updated when you update the template, but it sounds like you are describing something else. You're saying that changes to the template are not reflected even in courses created after the template change was made?
Hello, I am using 3.9 version of the plugin and I'm finding that changes made after the template has been used are not showing in future courses created using that template. Are templates not amendable after first use?
I'm not sure I 100% follow the precise nature of the issue here (not assigning blame, this plugin has some jargon and complexity difficulties), but I can review the way the plugin works: The ID NUMBER of new courses is matched to the SHORTNAME of the template course. So the shortname of your template matters, the shortname of your new courses does not.
I was struggling with getting this plugin to work while ignoring shortname (since the settings make it sound like everything hinges on idnumber) and creating courses that I _know_ match my regex from testing. Seeing Cory's comment, I changed my template's shortname to be the same as its idnumber and did the same with my created course—and it worked. So I don't know exactly what's going on but it seems like shortname is somehow related to the term code matching procedure.
Just a heads up... It seems that it DOES work if I do a traditional backup and restore of my template course to a new course that begins with the shortname naming convention. I guess there may be an issue with when shortnames are changed? Anyway, it seems to be working.
Hi, Charles. Thanks for developing this. I can't seem to get it to work though. I've tried multiple times using custom regex, and I can't get the courses to actually restore the templates. I finally decided to just straight up copy the example courses listed in the wiki, but even then, when using the supplied regex, I don't get the copy of the course. It is just a default course. I've looked at the logs, and it does have a record for the template being backed up when I create the new course, but there isn't a restore record anywhere. Am I missing something?
Thanks Charles. This is what I'm using that is coming up as invalid though it works in the regex testing site I linked (without the slashes).
/(?<=\_)(.*?)(?=\-)/
Scott: did you wrap your regular expression in slashes (e.g. /my-regex-here/)? The plugin expects them but doesn't add them if they're not present.
I'm trying this regex https://regex101.com/r/LbPXPV/2 and the plugin says the Term code value (the regex) is not valid. Any ideas?
Stefan.
You could try:
/().*/
This will (I think) match every ID and return an empty string. You should then give your template course a shortname of "template-".
do you know if its possible to create a regex that always returns the same value? like "throw away all numbers and replace with CONST"