michael-milette / moodle-filter_filtercodes

FilterCodes filter for Moodle enables content creators to easily customize and personalize course and site content using plain text tags (no HTML). For premium support, contact us at https://www.tngconsulting.ca/contact
https://moodle.org/plugins/filter_filtercodes
GNU General Public License v3.0
32 stars 43 forks source link

Update activity reference on course copy #209

Closed emmarichardson closed 2 years ago

emmarichardson commented 2 years ago

Is there anyway to get the activity reference to automatically update when you copy a course that has an activity completion filtercode in it? Moodle is great at updating any urls or links to activities from labels but the filtercode references are not updating and this would make it so much more powerful if there was a way to achieve this..

michael-milette commented 2 years ago

Hi @emmarichardson ,

To which tag are you referring?

Michael

emmarichardson commented 2 years ago

If activity completed or not completed.

emmarichardson commented 2 years ago

Realized I did not explain that well. I have a label in a course that shows some text if an activity is completed and different text if the activity is not completed. This is achieved using the filter codes for activity completion with the ID number of the activity. But if the course is copied to another course the ID of activity is now different. Is there anyway to get the filter code tag to automatically update to the new activity ID?

michael-milette commented 2 years ago

Hi @emmarichardson

Unfortunately I have not come up with a way around that limitation.

Michael

garetharnott commented 2 years ago

@emmarichardson - this is a common problem when you have lots of links - I know I need to make sure a new course is working properly as sometimes a link takes you to the previous course, which as a lecturer you don't realise. I know it might be tedious, but maybe just remove the filtercodes {} brackets before copying the course?

regards Gareth

emmarichardson commented 2 years ago

That doesn't work in my scenario. I have an office member copy the courses as part of a process. She does not have the skill to change links. Thanks for the suggestion though. For now, I have just removed any filter codes that are not generic enough to survive a course copy.

michael-milette commented 2 years ago

@emmarichardson - Unfortunately I don't have a solution for you at this time. Even if you remove the {} backets, the problem is that the IDs change when you make a copy of a course. It is a documented limitation for the {ifactivitycompleted id}{/ifactivitycompleted} tags:

Note: Activity IDs change when you copy or restore a course. In such cases, you will need to manually edit and correct the IDs in the tags to reflect the new activity id numbers to restore their functionality.

As there is nothing more that can be done in this case, I will close the ticket.

Best regards,

Michael