Forums

Name or user name?

jrizzo 07 May, 2010
Hello,

Is it possible to automatically include the username or full name of the user in the email template? Are there additional fields for this, or is it more involved than that?

Jon
GreyHead 07 May, 2010
Hi Jon,

The simplest way is this. In the OnSubmit before box put
<?php
$user =& JFactory::getUser();
JRequest::setVar('username', $user->username);
JRequest::setVar('name', $user->name);
?> 
Then you can use {username} and/or {name} in the Email template.

Bob

PS This may give odd results if the user isn't registered so the code may need extending/tweaking to cover this possibility.
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger