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
30 stars 42 forks source link

Feature Request: ifactivitycompleted for multiple activities #252

Closed LogFish closed 1 year ago

LogFish commented 1 year ago

Prerequisites

Feature Request - The User Story

I want to display content on a course page based upon multiple activities being completed(or not) - not just one. The conditional filtercodes bug out when I have multiple 'ifactivitycompleted ID' tags nested, or 'ifnotactivitycompleted'.

In my use-case, I have a course that is just a 'certification centre'. This course is intended to reward the learner with certificates for completing multiple other courses on the platform. The Custom Certificate plugin activity is fine, however when you want to reward learners for completing multiple courses on one certificate, you need to get creative!

  1. I added the subcourse plugin activities in a hidden topic within the certification centre. Those activities mark themselves completed based upon the completion settings on the referenced courses - all good.

  2. I added custom-certificate plugin activities to the certification course. I set access restrictions on these so the subcourses need to be completed before the certificate activities can be viewed/awarded/completed.

  3. It technically works, however the display of it all is very ugly. I wish to hide it from learners, by using nested conditional filtercodes on the subcourse activities and just manually show learners the certificates they've been rewarded with within the course html fields.

So ideally I'd like to go {ifactivitycompleted 5}{ifactivitycompleted 6}you got your certificate!Whizz-bang images and party time for learners, link to the now-available certificate{/ifactivitycompleted}{/ifactivitycompleted}

When you nest the same conditional it bugs out on the closing tags and leaves one on screen. I wondered if perhaps the conditional filtercodes that work on an id could have the function added to optionally list multiple ids, and if that'd be easier than editing however the closing tag stuff is working. I don't know Moodle coding but it seems these'd be returning a TRUE or FALSE at some point, so passing multiple IDs might not be the end of the world, just adding a check for if there's multipleids at the start of the function, and if so, iterating through and returning true if none of them result false.

{ifactivitycompleted 5,6}You passed{/ifactivitycompleted}

Screenshots / Mock-ups

No response

Alterative you have considered

No response

Additional information

I'll try and make this thing work nicely with some dirty javascript, but thought I'd share this feature request as it COULD be trivial, and it'd provide quite a lot of extra power to the filtercodes. Filtercodes are the difference between my site being rubbish and being really user-experienced focussed, so I thank you greatly for them exactly as they are anyway.

Planning on submitting a solution in a pull request (PR)?

No

Code of Conduct

michael-milette commented 1 year ago

Hi @LogFish ,

That is an excellent question. Thanks for asking.

You will need to use the very useful Pulse plugin for Moodle LMS by Stefan Scholz. It allows you to have one activity completion reflect the completed status of multiple other activities. Dave Foord has an excellent tutorial on how to use this on his YouTube channel at: https://www.youtube.com/watch?v=VlmLjIUFC6I

Once you have that setup, you will then be able to use FilterCodes {ifactivitycompleted} tag to do whatever you want based on the completion of the one Pulse activity.

Hope you found this information helpful.

Best regards,

Michael Milette