Skip to content

Commit

Permalink
Added new {$a->userfullname} tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Oct 14, 2024
1 parent b2fdacb commit a76ccfc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## [2.2.2] - 2024-10-13
### Updated
- Fixed support for plain text tag called {$a->userfullname}.
- Fixed deprecation notice running on PHP 8.3.

## [2.2.1] - 2024-04-28
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ Note that you can use any of the following plain text tags within the body of th
* {$a->emailmsgunsubscribe} : Unsubscribe/Support message.
* {$a->email} : Invitees email address - always available.
* {$a->username} : Invitees username - only available if the user already has an account on the site, otherwise blank.
* {$a->userfullname} : Invitees formatted full name - only available if the user already has an account on the site, otherwise blank.
* {$a->firstname} : Invitees first name - only available if the user already has an account on the site, otherwise blank.
* {$a->lastname} : Invitees last name - only available if the user already has an account on the site, otherwise blank.
* {$a->surname} : This is an alias for {$a->lastname}.
Expand Down
6 changes: 5 additions & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,13 @@ public function send_invitations($data, $resend = false) {
$messageparams->message = $data->message['text'];
$messageparams->email = $invitation->email;
if ($userexits) {
$messageparams->userfullname = fullname($contactuser);
$messageparams->firstname = $contactuser->firstname;
$messageparams->lastname = $contactuser->lastname;
$messageparams->surname = $contactuser->lastname;
$messageparams->username = $contactuser->username;
} else {
$messageparams->userfullname = '';
$messageparams->firstname = '';
$messageparams->lastname = '';
$messageparams->surname = '';
Expand Down Expand Up @@ -262,12 +264,14 @@ public function send_invitations($data, $resend = false) {
$contactuser->mailformat = 1;
$contactuser->maildisplay = true;
$invitation->userid = $contactuser->id;
$contactuser->userfullname = fullname($contactuser);
} else {
// User does not have an account yet.
$contactuser = new stdClass();
$contactuser->id = -1; // Required by new version of email_to_user since moodle 2.6.
$contactuser->email = $invitation->email;
$contactuser->mailformat = 1; // 0 (zero): text-only emails, 1 (one): for HTML/Text emails.
$contactuser->userfullname = '';
$contactuser->firstname = '';
$contactuser->lastname = '';
$contactuser->maildisplay = true;
Expand Down Expand Up @@ -465,7 +469,7 @@ public function enroluser($invitation) {
* Figures out who used an invite.
*
* @param object $invite Invitation record
* @return object Returns an object with following values:
* @return object|bool Returns an object with following values:
* ['username'] - name of who used invite
* ['useremail'] - email of who used invite
* ['roles'] - roles the user has for course that
Expand Down

0 comments on commit a76ccfc

Please sign in to comment.