Skip to content

Commit

Permalink
Added new {firstnamephonetic}, {lastnamephonetic}, {middlename} tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Dec 14, 2024
1 parent 59163d8 commit 0bcea9d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.

## [2.6.2] 2024-12-14 (dev)
- Performance optimization: Now caches login state.
- New {firstnamephonetic} tag.
- New {lastnamephonetic} tag.
- New {middlename} tag.

## [2.6.1] 2024-11-20
### Update
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ FilterCodes are meant to be entered as regular text in the Moodle WYSIWYG editor
* {firstname} : Display the user's first name.
* {surname} or {lastname} : Display the user's surname (family/last name).
* {fullname} : Display the user's first name and surname.
* {middlename} : Display the user's middle name.
* {firstnamephonetic} : Display the user's first name in phonetic.
* {lastnamephonetic} : Display the user's last name in phonetic.
* {alternatename} : Display the user's alternate name. If blank, it will display the user's first name instead.
* {city} : Display the user's city.
* {country} : Display the user's country.
Expand Down Expand Up @@ -1160,6 +1163,9 @@ Create a Page on your Moodle site, preferably in a course, so that those tags wo
* Surname [{surname}]: {surname}
* Last name [{lastname}]: {lastname}
* Full name [{fullname}]: {fullname}
* First name phonetic [{firstnamephonetic}]: {firstnamephonetic}
* Last name phonetic [{lastnamephonetic}]: {lastnamephonetic}
* Middle name [{middlename}]: {middlename}
* Alternate name [{alternatename}]: {alternatename}
* City [{city}]: {city}
* Country [{country}]: {country}
Expand Down
9 changes: 9 additions & 0 deletions classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,15 @@ function ($matches) use ($now) {
}
}

// Tags: {firstnamephonetic}, {lastnamephonetic}, {middlename}.
// Description: User's first name phonetic, last name phonetic and middle name as set in their profile.
// Parameters: None.
foreach (['firstnamephonetic', 'lastnamephonetic', 'middlename'] as $field) {
if (stripos($text, '{' . $field . '}') !== false) {
$replace['/\{' . $field . '\}/i'] = $this->isauthenticateduser() ? trim($USER->{$field}) : '';
}
}

// Tag: {email}.
// Description: User's email address as set in their profile.
// Parameters: None.
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024100702; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024100703; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014051200; // Requires Moodle version 2.7 or later.
$plugin->component = 'filter_filtercodes'; // Full name of the plugin (used for diagnostics).
$plugin->release = '2.6.1';
Expand Down

0 comments on commit 0bcea9d

Please sign in to comment.