Moodle Plugins directory: FilterCodes | Moodle.org
![Logo](https://moodle.org/pluginfile.php/50/local_plugins/plugin_logo/1893/logo.png?preview=thumb)
FilterCodes
The FilterCodes plugin for Moodle enables you to insert plain text tags like {firstname} into your Moodle site or course content in order to personalize the site to individual students.
Here are just a few examples of the ways you could use this plugin include:
- Personalize your course content with the learner's name and even their photo.
- Display certain content depending on the user's role.
- Conditionally display content depending on whether the user is enrolled in the current course.
- Create links that normally require the user's ID as part of the URL.
- Insert default user information into Contact Form for Moodle forms.
- Display your list of available courses and categories on the Front page (Home page) as cards.
- Display alert-type boxes.
- Create your own popup Help just like Moodle does (popup info icon also available)
- Display the amount of disk space available to Moodle, the number of courses, the number of active students and more.
- Display several pre-configured templates for use with the Contact Form plugin.
- Add notes or reminders within your course content - which is only visible when editing the content.
- Create dynamic and context-aware custom menus for students, teachers, managers and administrators (only supported by a few themes unless you apply a patch).
- Customize your dashboard with dynamic content.
- Display course progress bar and percentage.
- Easily display FontAwesome icons almost anywhere.
- Display content from the custom user and custom course fields on your course outline page. This can be useful for creating course templates for your organization.
- Conditionally display content depending on which cohort, group, role or Workplace tenant is looking at the content.
- Insert support information in every course and manage that information centrally.
- Easily list teachers, and non-editing teachers (assistants) in your course.
- Create buttons and charts.
Share with us how you use this plugin on your site.
Development efforts for this project are sponsored by the kind folks at TNG Consulting Inc.. Special thanks go out to several developers who have contributed to the development, documentation and testing of this release of FilterCodes, as well as to those who offered suggestions for many of the new tags. We appreciate your contributions!
Useful links
Once installed and enabled, the following plain-text tags (no HTML required) will become available to you anywhere that Moodle supports filtering.
List of FilterCode tags
Creating FilterCodes Documentation
- [{ }] : You can escape tags so they are not processed by adding [brackets] around the tag. Can be disabled in the plugin's settings if it causes you problems.
- [%7B %7D] : You can escape %7Bencoded%7D tags too so they are not processed by adding [brackets] around them.
Profile
- {firstname} : Displays the user's first name.
- {surname} or {lastname} : Displays the user's surname (family/last name).
- {fullname} : Displays the user's first name and surname.
- {alternatename} : Displays the user's alternate name. If blank, will display the user's first name instead.
- {city} : Displays the user's city.
- {country} : Displays the user's country.
- {timezone} : Displays the user's preferred time zone.
- {preferredlanguage} : Displays the user's preferred language in that language. Because of this, it will be encapsulated in an HTML span tag with an appropriately set lang attribute.
- {email} : Displays the user's email address.
- {userid} or %7Buserid%7D : Displays the user's Moodle ID.
- {idnumber} : Displays the user's id number from their profile.
- {username} : Displays the user's username.
- {userdescription} : Display the user's description.
- {webpage} : Displays the user's webpage as seen in their profile.
- {institution} : Displays the name of the institution from the user's profile.
- {department} : Displays the name of the department from the user's profile.
- {userpictureurl X} : Displays the user's profile picture URL. X indicates the size and can be sm (small), md (medium) or lg (large). If the user does not have a profile picture or is logged out, the default faceless profile photo URL will be shown instead.
- {userpictureimg X} : Generates an HTML tag containing the user's profile picture. X indicates the size and can be sm (small), md (medium) or lg (large). If the user does not have a profile picture or is logged out, the default faceless profile photo will be used instead.
- {profile_field_shortname} : Display the content of a custom profile field. Replace "shortname" with the shortname of a custom profile field all in lowercase. NOTE: Will not display if the custom profile field's settings are set to Not Visible.
- {profilefullname}: Similar to {fullname} except that it displays a profile owner's name when placed on the Profile page.
- {firstaccessdate dateTimeFormat} : Date that the user first accessed the site. For information on the optional dateTimeFormat format, see Supported dateTimeFormats Formats in the FAQ section of the documentation.
- {lastlogin dateTimeFormat} : Date/Time that you last logged into the site.
System Information
- {filtercodes} : Will display the version and release of FilterCodes plugin. Not that this information is only available to those who can edit the tag.
- {usercount} : Count the total number of registered users on the site. Does not include deleted users, primary admin or guests.
- {usersactive} : Count the total number of registered users on the site. Does not include deleted users, disabled users, primary admin or guests.
- {usersonline} : Total number of users who were online in the last 5 minutes.
- {siteyear} : 4-digit current year.
- {now dateTimeFormat} : Display the current date. For information on the optional dateTimeFormat format, see Supported dateTimeFormats Formats in the FAQ section of the documentation.
- {coursecount} : Total number of courses on this Moodle site (not including Front Page).
- {diskfreespace} : Displays the amount of free disk space for the application directory. An infinite symbol will be displayed if greater than about 84,703.29 Yottabyte (YB) or if it fails to get the size from the operating system.
- {diskfreespacedata} : Displays the amount of free disk space for moodledata directory. An infinite symbol will be displayed if greater than about 84,703.29 Yottabyte (YB) or if it fails to get the size from the operating system.
- {wwwroot} : Root URL of the Moodle site.
- {userscountrycount} : Total number of countries that users are from according to their profile.
-
{supportname} : Support name as seen on Site Administration > Server > Support contact.
-
{supportemail} : Support email address as seen on Site Administration > Server > Support contact.
-
{supportpage} : Support page URL as seen on Site Administration > Server > Support contact.
-
{supportservicespage} : Support services page URL as seen on Site Administration > Server > Support contact in Moodle LMS 4.2 and later.
UI Elements
-
(ALPHA) {coursecard id} : Displays an individual course card.
-
(ALPHA) {coursecards} : Displays available courses as cards. Has only been tested on Front Page.
- (ALPHA) {coursecards id} : Same as {coursecards} but you can specify the top-level category ID number to be displayed.
- (ALPHA) {courseprogress} : Displays course progress status in words. Only works within a course.
-
{courseprogresspercent}: Displays course progress percentage as a number without a percentage symbol. Only works within a course.
- (ALPHA) {courseprogressbar} : Displays course progress status as a status bar. Only works within a course.
- (ALPHA) {categorycards} : Display top-level categories as cards. Has only been tested on Front Page.
- {courserequest}: Display a Request a Course link.
- (ALPHA) {chart pie}: Display a 2-section pie chart.
- (ALPHA) {chart progressbar} : Displays a progress bar.
- (ALPHA) {chart progresspie} : Create a (circle / doughnut) progress chart.
- (ALPHA) {chart radial} : Displays a radial chart.
- {button url}Label{/button} : Displays link as a button.
- {hr} : Displays a horizontal rule line.
- {label backgroundtype}{/label} : Displays text over a colour background.
- {markborder}{/markborder} : Surrounds text with a red dashed border.
- {marktext}{/marktext} : Highlight text using HTML5's mark tag.
- {qrcode}{/qrcode} : Generates and displays a QR Code for the content between the tags.
- (ALPHA) {showmore}{/showmore} : Toggle showing content between opening and closing more tags.
- {mycoursescards} : Displays a series of cards for my enrolled courses.
- {teamcards} : Displays photos, names (optionally linked) and optional descriptions of the users who are teachers. Great for Faculty pages.
- (ALPHA) {dashboard_siteinfo} : Add this tag to your dashboard to display site information including the available disk space, number of courses, total users and users online. Only works for Site Administrators.
For use in courses
- {coursename} : Displays the full name of the current course or the site name if not in a course.
- {courseshortname} : Displays the short name of the current course or, if not in a course, the site's short name.
- {courseenrolmentdate dateTimeFormat} : Date and time at which the user was enrolled in the current course. For information on the optional dateTimeFormat format, see Supported dateTimeFormats Formats in the FAQ section of the documentation.
- {coursestartdate dateTimeFormat} : Course start date. Displays "Open event" if there is no start date. For information on the optional dateTimeFormat format, see Supported dateTimeFormats Formats in the FAQ section of the documentation.
- {courseenddate dateTimeFormat} : Course end date. Displays "Open event" if there is no end date. For information on the optional dateTimeFormat format, see Supported dateTimeFormats Formats in the FAQ section of the documentation.
- {coursecompletiondate dateTimeFormat} : Course completion date. If not completed, will display "Not completed". Will also detect if completion is not enabled. For information on the optional dateTimeFormat format, see Supported dateTimeFormats Formats in the FAQ section of the documentation.
- (ALPHA) {courseprogress} : Displays course progress status in words.
- (ALPHA) {courseprogressbar} : Displays course progress status as a status bar.
- {course_fields}: Displays the custom course fields. NOTE: Respects a custom course field's Visible To setting.
- {course_field_shortname} : Displays custom course field. Replace "shortname" with the short name of a custom course field all in lowercase. NOTE: Respects a custom course field's Visible To setting.
- {coursesummary} : Displays the course summary. If placed on a site page, displays the site summary.
- {courseimage} : Displays the course image.
- {courseimage-url} : URL of the course image.
- {courseparticipantcount} : Displays the number of students enrolled in the current course.
- {courseid} or %7Bcourseid%7D : Displays a course's ID.
- {coursecontextid}: Displays a course's context ID.
- %7Bcoursecontextid%7D : Displays a course's context ID - for use in URLs. Only for use in course activity modules.
- {courseidnumber} : Displays a course's ID number.
- {sectionid} or %7Bsectionid%7D : Displays the section ID (not to be confused with the section number).
- {sectionname} : Displays the section name in which the activity is located.
- {coursemoduleid} or %7Bcoursemoduleid%7D : Course module ID. Only works inside a course activity or resource module.
- (ALPHA) {coursecontacts} : List of the course teachers with optional links to their profile, email address or Moodle messaging.
- {mygroups} : Displays a list of groups to which you are a member.
- {courseunenrolurl} : The course unenrolment URL for you to place in a button or a link anywhere in the course.
- {coursecount students} : Displays the number of students enrolled in the course.
- {coursecount students:active} : Displays the number of users with the role of 'student' in a course who are not suspended in the course.
- {coursegradepercent} : Displays the current accumulated course grade of the student (no percentage symbol).
- {coursegrade} : Displays the student's current overall course grade (with percentage symbol).
Categories
- {categoryid} : If in a course, the ID of the course's parent category, the category ID of a course category page, otherwise 0.
- {categoryname} : If in a course, the name of the course's parent category, is otherwise blank.
- {categorynumber} : If in a course, the number of the course's parent category, is otherwise blank.
- {categorydescription} : If in a course, the number of the description of a course's parent category, is otherwise blank.
- {categories} : Displays an unordered list of links to all course categories.
- {categories0} : Displays an unordered list of just top-level links to all course categories.
- {categoriesx} : Displays an unordered list of other categories in the current category.
Custom menu
Note: Filtering must be supported in a custom menu by your theme. See README.md for more information.
- {categoriesmenu} : A second-level list of categories with links for use in custom menus.
- {categories0menu} : A second-level list of just top-level categories with links for use in custom menus.
- {categoriesxmenu} : A second-level list of other categories in the current category with links for use in custom menus.
- {toggleeditingmenu} : A Turn Editing On or Turn Editing Off custom menu item. Note that you need to add your own dash(es).
- {mycoursesmenu} : A second-level list of courses with links for use in custom menus (filtering must be supported by the theme).
- {courserequestmenu0} : Request a course / Course request in a top-level custom menu.
- {courserequestmenu} : Request a course / Course request in a submenu.
- {menudev} : Useful menu for Moodle developers.
- {menuadmin} : Userful dynamic menu for Moodle administrators, managers and teachers (is context sensitive).
- {menuthemes} : Theme switcher with link to Advanced Theme Settings and settings of active theme. Switching theme in URL must be enabled for this to work. Tip: If you only want the admin user to have access, wrap it like this: {ifadmin}{menuthemes}{/ifadmin}. There is no need for a separate theme switcher plugin anymore. This is especially useful for theme developers.
URL
- {pagepath} : Path of the current page without wwwroot.
- {thisurl} : The complete URL of the current page.
- {thisurl_enc} : The complete encoded URL of the current page.
- {urlencode}{/urlencode} : URL encodes any content between the tages.
- {referer} or {referrer} : Referring URL
- {protocol} : http or https
- {ipaddress} : User's IP Address.
- {sesskey} or %7Bsesskey%7D : Moodle session key.
- {wwwcontactform} : Action URL for Contact Form forms. (requires Contact Form plugin).
Content
- {global_...} : Use your own custom FilterCodes tags in the filter's settings. This is sometimes referred to as global blocks. An example of this might be if you wanted to define a standardized copyright or other text, email address, website URL, phone number, name, link, support information and more. Define and centrally manage up to 20 global block tags.
- {note}content{/note} : Enables you to include a note which will not be displayed.
- {help}content{/help} : Enables you to create popup help icons just like Moodle does.
- {info}content{/info} : Enables you to create popup help icons just like the popup Help icons but with an "i" information icon.
- {alert style}content{/alert}: (ALPHA) Creates an alert box containing the specified content. You can change the style by specifying an optional parameter. Example:
{alert primary}
or{alert success}
. See List of styles. In addition to the style name, you can also specify the keyword "border" to add a border around the alert box. - {highlight}{/highlight} : Highlight text. NOTE: Must only be used within a paragraph.
- {scrape url="..." tag="..." class="..." id="..." code="..."} : Scrapes the content from another web page. Must be enabled in FilterCodes settings.
- {getstring:component_name}stringidentifier{/getstring} or {getstring}stringidentifier{/getstring}: Display a Moodle language string in the current language. If no component name (plugin) is specified, will default to "moodle".
- {fa/fas/fa-solid/fab/fa-brands fa-...} : Insert FontAwesome icon. Note: FontAwesome Font/CSS must be loaded as part of your theme. For FontAwesome v6.0 icons, you need Moodle 4.2+.
- {glyphicon glyphicon-...} : Insert Glyphicons icon. Note: Glyphicons Font/CSS must be loaded as part of your theme.
- {mycourses} : Displays an unordered list of links to all my enrolled courses.
- {myccourses} : Displays an unordered list of links to all my completed courses - only includes courses with completion tracking enabled.
Contact Form templates
The following tags are replaced by Contact Form templates and therefore require that you have the Contact Form for Moodle plugin installed.
- {formquickquestion} : Adds a "quick question" form to your course. The form includes Subject and Message fields. Note: The user must be logged in or the form will not be displayed.
- {formcontactus} : Adds a "Contact Us" form to your site (example: in a page). The form includes Name, Email address, Subject and Message fields.
- {formcourserequest} : Adds a "Course Request" form to your site (example: in a page). Unlike Moodle's request-a-course feature where you can request to create your own course, this tag allows users to request that a course they are interested in be created. Could also be used to request to take a course. The form includes Name, Email address, Course name, and Course Description.
- {formsupport} : Adds a "Support Request" form to your site (example: in a page). The form includes Name, Email address, pre-determined Subject, specific Subject, URL and Message fields.
- {formcheckin} : Adds an "I'm here!" button to your course. The form does not include any other fields. Note: The user must be logged in or the button will not be displayed.
Useful for creating Custom Contact Forms and Links
- {lang} : Displys th 2-letter language code of current Moodle language.
- {recaptcha} : Displays the ReCAPTCHA field - for use with Contact Form for Moodle. Note: Will be blank if a user is logged in using a non-guest account.
- {readonly} : To be used within form input fields to make them read-only if the user is logged in.
- {editingtoggle} : "off" if in edit page mode. Otherwise "on". Useful for creating Turn Editing On/Off links.
- {wwwcontactform} : Action URL for Contact Form forms. (requires Contact Form plugin).
- {formsesskey} : Not a form. This can be used instead of having to insert the required hidden input field and JavaScript Snippet.
Conditionally display content filters (All versions of Moodle)
Note: {ifrolename
} and {ifminrolename
} type tags are based on role archetypes, not role short names. For example, you could have a role called students
but, if the archetype for the role is teacher
, the role will be identified as a teacher
. Roles not based on archetypes will not with these tags.
Logged in/out
- {ifloggedin}{/ifloggedin} : Displays the enclosed content only if the user is logged in as a non-guest.
- {ifloggedout}{/ifloggedout} : Displays the enclosed content only if the user is logged out or is logged in as a guest.
- {ifloggedinas}{/ifloggedinas} : Displays the enclosed content only if you are logged-in-as (loginas) a different user.
- {ifnotloggedinas}{/ifnotloggedinas} : Displays the enclosed content only if you are logged in as yourself and not a different user.
Courses
- {ifenrolled}{/ifenrolled} : Displays the enclosed content only if the user is enrolled as a student in the current course. This tag does not take any other roles into consideration.
- {ifnotenrolled}{/ifnotenrolled} : Displays the enclosed content only if the user is not enrolled as a student in the current course. This tag does not take any other roles into consideration.
- {ifincourse}{/ifincourse} : Displays the enclosed content only if the user is in a course other than the Front page.
- {ifnotincourse}{/ifnotincourse} : Displays the enclosed content only if the user is not in a course.
- {ifinsection}{/ifinsection} : Displays the enclosed content only if the user is in a section of a course which is not the Front Page.
- {ifnotinsection}{/ifnotinsection} : Displays the enclosed content only if the user is not in a section of a course.
- {ifingroup id|idnumber}{/ifingroup} : Displays content if the user is part of the specified course group ID or group ID number.
-
{ifnotingroup id}{/ifnotingroup} : Displays content if the user is NOT part of the specified course group ID or group ID number.
- {ifprofile_field_shortname}{/ifprofile_field_shortname} : Displays the enclosed content if the custom profile field is not blank/zero.
- {ifactivitycompleted id}{/ifactivitycompleted} : Displays content if the activity or resource specified by ID has been completed.
- {ifnotactivitycompleted id}{/ifnotactivitycompleted} : Displays content if the activity or resource specified by ID has not been completed.
- {ifinactivity}{/ifinactivity} : Displays enclosed content if the user is currently inside an activity or resource.
- {ifnotinactivity}{/ifnotinactivity} : Displays enclosed content if the user is not currently inside an activity or resource.
- {ifvisible}{/ifvisible} : Displays the enclosed content if the course visibility is set to Show.
- {ifnotvisible}{/ifnotvisible} : Displays the enclosed content if the course visibility is set to Hide.
Roles
- {ifguest}{/ifguest} : Displays the enclosed content only if the user is logged in as a guest.
- {ifstudent}{/ifstudent} : Displays the enclosed content only if the user is logged in and enrolled in the course (no other roles).
- {ifassistant}{/ifassistant} : Displays the enclosed content only if the user is logged in as a non-editing teacher in the current course.
- {ifminassistant}{/ifminassistant} : Displays the enclosed content only if the user is logged in as a non-editing teacher or above in the current course.
- {ifteacher}{/ifteacher} : Displays the enclosed content only if the user is logged in as a teacher in the current course.
- {ifminteacher}{/ifminteacher} : Displays the enclosed content only if the user is logged in as a teacher or above in the current course.
- {ifcreator}{/ifcreator} : Displays the enclosed content only if the user is logged in as a course creator.
- {ifmincreator}{/ifmincreator} : Displays the enclosed content only if the user is logged in as a course creator or above.
- {ifmanager}{/ifmanager} : Displays the enclosed content only if the user is logged in as a manager.
- {ifminmanager}{/ifminmanager} : Displays the enclosed content only if the user is logged in as a manager or above.
- {ifminsitemanager}{/ifminsitemanager} : Displays the enclosed content only if the user is logged in as a site manager or above.
- {ifadmin}{/ifadmin} : Displays the enclosed content only if the user is logged in as an administrator.
- {ifcustomrole roleshortname}{/ifcustomrole} : Displays enclosed content only if the user has the custom role specified by its short name within the current context.
- {ifnotcustomrole roleshortname}{/ifnotcustomrole} : Displays enclosed content only if the user does not have the custom role specified by its short name within the current context.
- {ifincohort CohortID|idnumber}{/ifincohort} : Displays enclosed content only if the user is a member of the specified cohort. You can specify the Cohort ID in your cohort settings or its ID number. Cohort ID can contain a combination of letters from a to z, A to Z, numbers 0 to 9, dash and underscores. It will not work if it contains spaces or other special characters.
- {ifhasarolename roleshortname}{/ifhasarolename}: Displays enclosed content if the user has been assigned the specified role anywhere in the Moodle site within any context.
Miscellanious
- {ifdev}{/ifdev} : Displays the enclosed content only if the user is logged in as an administrator and developer debugging mode is enabled.
- {ifhome}{/ifhome} : Displays the enclosed content only if the user is on the Moodle Home Frontpage.
- {ifnothome}{/ifnothome} : Displays the enclosed content only if the user is not on the Moodle Home Frontpage.
- {ifdashboard}{/ifdashboard} : Displays the enclosed content only if the user is on the Moodle Dashboard.
- {ifcourserequests}{/ifcourserequests} : Displays enclosed contents only if the Request a Course feature is enabled.
- {ifeditmode}{/ifeditmode} : Displays the enclosed content only if editing mode is turned on.
- {ifmobile}{/ifmobile} : Displays the enclosed content if it is being accessed from the mobile app or through a Web service.
- {ifnotmobile}{/ifnotmobile} : Displays the enclosed content if not being accessed from the mobile app or through a Web service.
- {iftheme themename}{/iftheme} : Display the enclosed content if the specified theme is active.
- {ifnottheme themename}{/ifnottheme} : Display the enclosed content if the specified theme is NOT active.
If the condition is not met in the particular context, the specified tag and its content will be removed.
Conditionally display content filters (For Moodle Workplace)
- {iftenant idnumber|tenantid}{/iftenant} : Displays the content if a tenant id number or tenant id is specified. Only {iftenant 1} will work in Moodle classic.
- {ifworkplace}{/ifworkplace} : Displays the content only if displayed in Moodle Workplace.
HTML and "lang" tagging
- {-} : Is substituted for a soft hyphen that only appears when needed.
- {nbsp} : Is substituted for a non-breaking space when displayed.
- {langx xx}{/langx} : Tag specific text in a particular language by wrapping the text in a plain text pair of {langx xx} {/langx} or {langx xx-XX} {/langx} tags. This makes no visible changes to the content but wraps the content in an HTML <span lang="xx" xml:lang="xx"></span> inline tag. As a result, screen readers will use this localization information to apply a particular pronunciation if the text is in a different language than the rest of the page. This is required for compliance with W3C Web Content Accessibility Guidelines (WCAG 2.0)
- {multilang xx}{/multilang} : A plain-text substitute for Moodle core's Multi-Language Content filter span tags. For this tag to work, the Multi-Language Content filter must be enabled as FilterCodes doesn't do any language filtering itself. It just makes it easier to tag the text.
- {details}{summary}{/summary}{/details} : An easy way to create an HTML 5 Details/Summary expandable section on your page. IMPORTANT: {details}{summary}{/summary} must all be on one line (it is ok if the line wraps). The rest of the details can be on multiple lines followed by the {/details}. This experimental feature may result in invalid HTML, but it works.
- {hr}: Displays a horizontal rule line.
For more information and an up-to-date list of tags, see the README.md documentation file included with the plugin.
Once set up, it just works automatically and a really neat way to get people seeing what they need to see.
First of all, thank you for your amazing job, you saved many time for my team and will save many more in the future.
I have a question : I would like to allow users to write FilterCodes tags in admin_settingconfigtext or admin_settingconfigtextarea fields of my plugins but it doesn't seem to work and seems to escape automatically the tags.
Is there a chance that it can be possible in a near future to use FilterCodes in settings'pages?
Or maybe it is already the case and I have completely missed the information ?
Thanks in advance,
Best regards
Stephen Bornet
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
Thanks a lot for your prompt and comprehensive response, it works perfectly now with the format_text() function.
Best regards,
Stephen
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.
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
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
I understand now where my mistake is
Have a nice day !
C.
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.
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
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.
[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]#
Best regards,
Michael
You can hide the displayed role using CSS to hide the fc-coursecontactroles class for the {coursecontacts} tag.
Best regards,
Michael