Email Template Hooks
FluentCRM Core IntermediateThese action hooks fire when email templates are created, updated, or duplicated.
Argument order is not consistent
created and duplicated pass the template ID first; updated passes the posted data first and the model second. Check each signature rather than assuming a shared shape.
fluent_crm/email_template_created
This action runs after an email template has been created.
Parameters
$templateIdINT - Created Template ID$templateDataArray - the posted template data, before it was split into post fields and post meta
Usage:
php
add_action('fluent_crm/email_template_created', function($templateId, $templateData) {
// Do your stuff here
}, 10, 2);Source: app/Http/Controllers/TemplateController.php
fluent_crm/email_template_duplicated
This action runs after an email template has been duplicated.
Parameters
$newTemplateIdINT - the ID of the new copy$templateTemplate Model - the original template that was copied, not an array
Usage:
php
add_action('fluent_crm/email_template_duplicated', function($newTemplateId, $template) {
// $template is the ORIGINAL; $newTemplateId is the copy
}, 10, 2);Source: app/Http/Controllers/TemplateController.php
fluent_crm/email_template_updated
This action runs after an email template has been updated.
Parameters
$templateDataArray - the posted update data as key/value pairs$templateTemplate Model - re-read after the update, so it holds the saved values
Usage:
php
add_action('fluent_crm/email_template_updated', function($templateData, $template) {
// Note the order: data first, model second
}, 10, 2);Source: app/Http/Controllers/TemplateController.php