When using New Traditional Mail or new AB Mailing with Mosaico Template the [show_link] and [unsubscribe_link] are not replaced.
This is caused by the fact that the hook hook_civicrm_alterMailContent
is invoked from different places from CiviCRM Core (such as send scheduled reminders and send mass mailings). The parameter $content
has different data depending on where the function is invoked.
Here is what the call looks like from CRM_Core_BAO_MessageTemplate
: https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/BAO/MessageTemplate.php#L504
Here is what the call looks like from CRM_Mailing_BAO_Mailing
: https://github.com/civicrm/civicrm-core/blob/master/CRM/Mailing/BAO/Mailing.php#L715