'{domain.address}' => ts('Domain (organization) address'),
'{domain.phone}' => ts('Domain (organization) phone'),
'{domain.email}' => ts('Domain (organization) email'),
+ '{mailing.key}' => ts('Mailing key'),
'{mailing.name}' => ts('Mailing name'),
'{mailing.group}' => ts('Mailing group'),
'{mailing.viewUrl}' => ts('Mailing permalink'),
$this->_mailingID = CRM_Utils_Request::retrieve('id', 'String', CRM_Core_DAO::$_nullObject, TRUE);
}
+ // Retrieve contact ID and checksum from the URL
+ $cs = CRM_Utils_Request::retrieve('cs', 'String');
+ $cid = CRM_Utils_Request::retrieve('cid', 'Int');
+
// # CRM-7651
// override contactID from the function level if passed in
if (isset($contactID) &&
) {
$this->_contactID = $contactID;
}
+
+ // Support checksummed view of the mailing to replace tokens
+ elseif (!empty($cs) && !empty($cid) && CRM_Contact_BAO_Contact_Utils::validChecksum($cid, $cs)) {
+ $this->_contactID = $cid;
+ }
+
else {
$this->_contactID = CRM_Core_Session::getLoggedInContactID();
}
public function __construct() {
parent::__construct('mailing', [
'id' => ts('Mailing ID'),
+ 'key' => ts('Mailing Key'),
'name' => ts('Mailing Name'),
'group' => ts('Mailing Group(s)'),
'subject' => ts('Mailing Subject'),
],
'mailing' => [
'id',
+ 'key',
'name',
'group',
'subject',
$value = $mailing ? $mailing->id : 'undefined';
break;
+ // Key is the ID, or the hash when the hash URLs setting is enabled
+ case 'key':
+ $value = $mailing->id;
+ if ($hash = CRM_Mailing_BAO_Mailing::getMailingHash($value)) {
+ $value = $hash;
+ }
+ break;
+
case 'name':
$value = $mailing ? $mailing->name : 'Mailing Name';
break;