Filters: FilterCodes

filter_filtercodes
Maintained by Picture of Michael Milette Michael Milette
The FilterCodes filter enables Moodle content creators to easily customize and personalize site and course content using plain text tags.
1 sites
49 downloads
4 fans

The FilterCodes plugin for Moodle enables you to insert plain text tags like {firstname} into your Moodle site or course content in order to to personalize the site to the individual students.

Examples uses for this plugin include:

  • Personalizing course content.
  • 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 users ID as part of the URL.
  • Insert default user information into Contact Form for Moodle forms.
Share with us how you use this plugin on your site.

The work for this project was sponsored by the kind folk at TNG Consulting Inc..

Once installed and enabled, the following plain-text tags (no HTML required) will become available to you anywhere that Moodle supports filtering:


Moodle metadata filters

  • {firstname} : Display the user's first name.
  • {surname} : Display the user's surname (family/last name).
  • {fullname} : Display the user's first name and surname.
  • {email} : Display the user's email address.
  • {username} : Display the user's username.
  • {userid} : Display the user's ID.
  • {courseid} : Display a course's ID.
  • {wwwroot} : Display the root URL of the Moodle site.
  • {protocol} : http or https
  • {referrer} : Referring URL
  • {ipaddress} : User's IP Address.
  • {recaptcha} : Display the recaptcha field - for use with Contact Form for Moodle. (UNTESTED)

Conditionally display content filters

  • {ifenrolled}{/ifenrolled} : Will display the enclosed content only if the user **is** enrolled in the current course.
  • {ifnotenrolled}{/ifnotenrolled} : Will display the enclosed content only if the user is **not** enrolled in the current course.
  • {ifloggedin}{/ifloggedin} : Will display the enclosed content only if the user is logged in as non-guest.
  • {ifloggedout}{/ifloggedout} : Will display the enclosed content only if the user is logged out or is loggedin as guest.
  • {ifguest}{/ifguest} : Will display the enclosed content only if the user is logged-in as guest.
  • {ifstudent}{/ifstudent} : Will display the enclosed content only if the user is logged-in and enrolled in the course (no other roles).
  • {ifassistant}{/ifassistant} : Will display the enclosed content only if the user is logged-in as a non-editing teacher in the current course.
  • {ifminassistant}{/ifminassistant} : Will display the enclosed content only if the user is logged-in as a non-editing teacher or above in the current course.
  • {ifteacher}{/ifteacher} : Will display the enclosed content only if the user is logged-in as a teacher in the current course.
  • {ifminteacher}{/ifminteacher} : Will display the enclosed content only if the user is logged-in as a teacher or above in the current course.
  • {ifcreator}{/ifcreator} : Will display the enclosed content only if the user is logged-in as a course creator.
  • {ifmincreator}{/ifmincreator} : Will display the enclosed content only if the user is logged-in as a course creator or above.
  • {ifmanager}{/ifmanager} : Will display the enclosed content only if the user is logged-in as a manager.
  • {ifminmanager}{/ifminmanager} : Will display the enclosed content only if the user is logged-in as a manager or above.
  • {ifadmin}{/ifadmin} : Will display the enclosed content only if the user is logged-in as an administrator.

If the condition is not met in the particular context, the specified tag and it's content will be removed.

HTML and "lang" tagging

  • {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} tags. This makes no visible changes to the content but wraps the content in an HTML <span lang="xx"></span> inline tag. As a result, screen readers will make use of this information to use a particular kind of pronunciation if the text is in a different language than the language of the rest of the page. This is required for compliance with W3C Web Content Accessibility Guidelines (WCAG 2.0)

For more information, see the documentation link.

Screenshots

Screenshot #0
Screenshot #1

Contributors

Picture of Michael Milette
Michael Milette (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
Please login to post comments