Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
email template
-
- nuBuilder Team
- Posts: 4470
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 75 times
- Been thanked: 498 times
- Contact:
-
- nuBuilder Team
- Posts: 4470
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 75 times
- Been thanked: 498 times
- Contact:
Re: email template
Thanks!! A welcome email is sent now. Great !! Best to delete the old nuwelcome email templates?
Can i now set a welcome email to a category of users ( which field in the new user addition?)
Can i now set a welcome email to a category of users ( which field in the new user addition?)
-
- nuBuilder Team
- Posts: 4470
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 75 times
- Been thanked: 498 times
- Contact:
Re: email template
Now you can set up your different welcome email templates.
1. Open the template
2. Enter a code (e.g.
3. Modify the subject, body, etc., and save the template.
Next, repeat the process for another group:
1. Open the template
2. Enter a code (e.g.
3. Modify the subject, body, etc., and save the template.
Note: To allow multiple templates with the same code, run this SQL update first:
Old welcome templates can be deleted if they are no longer required.
Next instructions will follow when done
1. Open the template
nu_send_welcome_email_template
and click Clone
.2. Enter a code (e.g.
send_welcome_email
) and set a group (e.g. manager
).3. Modify the subject, body, etc., and save the template.
Next, repeat the process for another group:
1. Open the template
nu_send_welcome_email_template
again and click Clone
.2. Enter a code (e.g.
send_welcome_email
— either the same as in step 1 or a different one) and set a group (e.g. sales
).3. Modify the subject, body, etc., and save the template.
Note: To allow multiple templates with the same code, run this SQL update first:
Code: Select all
UPDATE zzzzsys_object
SET sob_all_validate = 1
WHERE zzzzsys_object_id = 'nu635294e972f5f54';
Next instructions will follow when done

-
- nuBuilder Team
- Posts: 4470
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 75 times
- Been thanked: 498 times
- Contact:
Re: email template
The last step is to create your own "Send Welcome email" procedure.
1. Open the Procedure template
2. Click
3. Overwrite the existing code by pasting the code below and adapt the code to use your ids etc.
4. Save it
The corresponding access level IDs can be retrieved as follows:
1. Open an access level.
2. Press
3. The displayed
1. Open the Procedure template
nu_send_welcome_email_template
.2. Click
Clone
(the code
field will automatically change to nu_send_welcome_email
).3. Overwrite the existing code by pasting the code below and adapt the code to use your ids etc.
Code: Select all
// Retrieve Information about the user
$user = nuUserSavedInfo();
$accessLevelId = $user["access_level_id"];
// Decide which template to use based on access level
// <<<<<<<< Use your access level ids, template name and group names <<<<<<<<<<<<<<<<<<<<<<<
switch ($accessLevelId) {
case '2660a0de8f28a50': // Manager access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'manager'); // E.g. "manager" is what you entered in the group field
break;
case '2660a0de8f28a52': // sales access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'sales');
break;
default: // Fallback (if access level not recognized)
$template = nuGetEmailTemplateData("send_welcome_email", '', 'default');
break;
}
if ($template == false) {
nuDisplayError('Unknown email template!');
return;
}
$sendResult = sendEmailFromTemplate($template);
if ($sendResult[0] != true) {
nuDisplayError($sendResult[1].'<br>'.$sendResult[2]);
}
// Sends an email message using an email template.
function sendEmailFromTemplate($template) {
$body = str_replace('#'.'NUBUILDER_URL'.'#', nuGetHttpOrigin() , $template['body']);
$params = array(
'to' => $template['to'],
'cc' => $template['cc'],
'bcc' => $template['bcc'],
'body' => nl2br($body),
'subject' => $template['subject']
);
// Replace all Hash Cookies
foreach ($params as $key => $value) {
$params[$key] = nuReplaceHashVariables($value);
}
return nuSendEmail($params);
}
The corresponding access level IDs can be retrieved as follows:
1. Open an access level.
2. Press
Ctrl+Shift+M
(or go to Options Menu - Form Info
).3. The displayed
Record ID
is the access level ID.Re: email template
Great thanks for the help. Excuses my ignorance: how can i combine a new user and a specific welcome email using the recordID
-
- nuBuilder Team
- Posts: 4470
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 75 times
- Been thanked: 498 times
- Contact:
Re: email template
Can you elaborate a bit? I don’t quite understand what you mean by combining a new user and a welcome email with the recordID
Re: email template
I'll try.
In emailtemplates is a field " category". I thought that adding an user it would be possible in that userform to fill in also the categoryname in a field and that as a consequence for the new user the intended welcome-email would be send
-----------------------------------------------------------------------------------------------
According your instructions: the recordID of the accesslevel 'vrijwilliger' = 67e3ff43a45adc2.
In the cloned emailtemplate I adjusted the code with this accesslevel as follows:
case '67e3ff43a45adc2': // vrijwilliger access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'vrijwilliger'); // E.g. "vrijwilliger" is what you entered in the group field
break;
The name 'vrijwilliger' entered in the group field.
Entering a new user as 'vrijwilliger' results not in the adjusted template.
What am I doing wrong?
In emailtemplates is a field " category". I thought that adding an user it would be possible in that userform to fill in also the categoryname in a field and that as a consequence for the new user the intended welcome-email would be send
-----------------------------------------------------------------------------------------------
According your instructions: the recordID of the accesslevel 'vrijwilliger' = 67e3ff43a45adc2.
In the cloned emailtemplate I adjusted the code with this accesslevel as follows:
case '67e3ff43a45adc2': // vrijwilliger access level id
$template = nuGetEmailTemplateData("send_welcome_email", '', 'vrijwilliger'); // E.g. "vrijwilliger" is what you entered in the group field
break;
The name 'vrijwilliger' entered in the group field.
Entering a new user as 'vrijwilliger' results not in the adjusted template.
What am I doing wrong?