FilterCodes icon

FilterCodes

Maintained by Michael Milette
Transform your Moodle site with the FilterCodes Plugin! Elevate engagement by inserting about 200 dynamic plain-text tags like {firstname} to create personalized learning experiences, customize your site and course content, display progress bars, simplify Contact Form customization effortlessly and much more. FilterCodes empowers educators to revolutionize Moodle into a dynamic, personalized platform. Join the community of FilterCodes enthusiasts to unlock the potential of your Moodle LMS site.
Price option: Free

Supports Moodle 2.7-5.2 See all versions
Latest release: 1 week ago
Installations: 7815
Downloads (last 90 days): 2421

Frankenstyle name: filter_filtercodes
Filters

Comments

Comments are no longer open for new posts. Existing comments remain available to read.

It would be amazing if it was possible to have a filter code for days remaining - but I expect the problem will be the fact there are many different enrolment methods in Moodle (Manual, self, cohort sync, course meta-link etc) - which are all different, and what happens if someone is enrolled via more than one method. There is a block available already that does this: https://moodle.org/plugins/block_enrolmenttimer but this only works if the user is enrolled onto the course by 1 method only, if they are enrolled by more than 1 method, then it displays nothing.
Can we display enrollment expiry days remaining in a course. Right now there is end date of course in filter codes but i could not find user enrollment expiry date. Any suggestions.
Regards
Binu
Hi Wolfgang,
You can hide the displayed role using CSS to hide the fc-coursecontactroles class for the {coursecontacts} tag.
Best regards,
Michael
Hi Vikas, the file your would need to make changes in is likely core_renderer.php or possibly renderer.php
Best regards,
Michael
Hi Michael, Thanks for this filtercodes plugin. It's quite useful and a game-changer. I would want a bit of advise on patching the Moove theme. I tried following the instructions on your git page but got lost a bit. here is the tree of my directories.
[root@ip-172-31-43-116 output]# pwd
/efs/itpanther/moodle/theme/moove/classes/output
[root@ip-172-31-43-116 output]# tree .
.
├── core
│   ├── course_renderer.php
│   └── course_renderer.php.bak
├── core_course
│   └── activity_navigation.php
├── core_renderer.php
└── renderer.php
2 directories, 5 files
[root@ip-172-31-43-116 output]#
Hi Michael,
Thanks again for your quick reaction. Indeed, i tried "Approuvé" (IOW using moodle own multi-language plugin) and ... it generates "ApprouvéGoedgekeurd". This is the issue I'll try to report.
Thanks,
C.
Hi Christophe,
While filters work in many/most parts of Moodle, there are still parts of Moodle where they do not work. This is not a problem with the filter type plugins but with the way that the activity plugins were written - like the core Glossary, H5Ps and some quiz question types. So it is very possible that it does not work with some parts of the database plugin.
I would suggest that you report the issue in the Moodle Tracker at:
https://tracker.moodle.org
Hopefully, if it can be resolved with a relatively simple fix, someone will get it through quickly. Comment back with the tracker number and I will be happy to vote for it as I am sure others having multi-language sites will too.
Tip: When reporting the issue, show that Moodle's own Multi-Language Content plugin doesn't work. Sometimes, when you use a 3rd party plugin like FilterCodes as your example, someone might claim that it is an issue with the plugin instead of of seeing it as a core issue. Another way to accellerate the process is to also submit a fix for the issue if you have the ability.
Hope you can get this resolved quickly.
Best regards,
Michael Milette
Hi,
I love this plugin, as it helps me resolve a lot of challenges in a multilingual env. But should it be possible that the {multilang xx}{/multilang} filter code does not work on Database field names ? The filter isn't interpreted in the templates and show as-is in the views. However, it works in the datafield. By exemple in the Single View, in French, I'm getting "{multilang fr}Intitulé de votre formation{/multilang}{multilang nl}Title van uw opleiding{/multilang}: Bonjour" and "{multilang fr}Intitulé de votre formation{/multilang}{multilang nl}Title van uw opleiding{/multilang}: Goeiendag" in Dutch.
Thanks for helping,
C.
Thanks a lot Michael!
I understand now where my mistake is smile Your answer makes it work !
Have a nice day !
C.
Hi Christophe,
The {langx} simply tags the text in a certain language so that screen readers correctly pronounce words. For example, if you have a Dutch word on an English page.
If you want to use the Multi-Language Content plugin, you should use the {multilang xx} FilterCodes tag. This gets converted to the HTML span tags that the Multi-Language Content plugin understands and can filter. For this reason, it is important that FilterCodes appears first in the list of filters followed by the Multi-Language Content filter in Manage Filters.
Alternatively, you might want to consider using the Multi-Language Content (v2) plugin available in on moodle.org/plugins. it is much more efficient, flexible and has a shorter syntax, {mlang xx}, than the Multi-Language Content combined with FilterCodes.
Last but not least, be sure to specify the language codes in lowercase, e.g., en and nl, not EN and NL.
Hope you find this information helpful.
Best regards,
Michael Milette
Thanks Dave for your quick answer!
Helas, I already checked this: Multi-language content and Filter Codes are set on "content and headings" - sorry, I could have mention it in OP...
Any other idea ?
TIA
@Cristophe - if you go to ***yourmoodle***/admin/filters.php - you will have a list of filters - in there you can change the settings to 'content and headings'
Hi Michael,
I'm trying to use the plugin to create a multilanguage (FR/NL) course. The translation in content is OK, but in doesn't work in section or activities titles :
exemple : {langx FR}Positionner la formation{/langx}{langx NL}De opleiding positioneren{/langx} generates : "Positionner la formationDe opleiding positioneren".
Should it work ? Did I miss a parameter somewhere ?
TIA
C.
Hi Michael,
Thanks a lot for your prompt and comprehensive response, it works perfectly now with the format_text() function.
Best regards,
Stephen
Hi Stephen,
Thank you Stephen.
I am happy that FilterCodes has saved you and your team a lot of time.
As for the admin_setting_config_text and admin_setting_config_textarea methods, the fields themselves on your plugin's settings page should not be escaping the FilterCodes tags. In fact, when you save your settings, the content of these fields should maintain the integrity of the tags exactly as entered when writing to the database. For more information, see:
https://moodledev.io/docs/apis/subsystems/admin
Moodle filters are typically applied using Output API functions such as format_string and format_text. For more information, see:
https://moodledev.io/docs/apis/subsystems/output#string-formatting-functions
However, the admin_settings_... methods may be cleaning the input depending on the PARAM_ type you specified in your code. For more information, see:
https://docs.moodle.org/dev/lib/formslib.php_Form_Definition
Hope you find this information helpful.
Best regards,
Michael