Commit c13b1a45 authored by Rich's avatar Rich

Fix #2. Changes token format to actionlink.idN

parent 015e2aaf
......@@ -132,7 +132,7 @@ There's the old skool way, which you can use in Message Templates for
example. You should enter tokens like:
```
Hey, click this: {actionlink.1}
Hey, click this: {actionlink.id1}
```
where `1` is the Action Link ID.
......
......@@ -244,7 +244,7 @@ function actionlinks_evaluate_tokens(\Civi\Token\Event\TokenValueEvent $e) {
/**
* Declare tokens the old skool way. This works with message templates.
*
* Tokens are like {actionlink.N} where N is the link ID.
* Tokens are like {actionlink.idN} where N is the link ID.
*/
function actionlinks_civicrm_tokens(&$tokens) {
// Get list of all active Action Links, add tokens for them like actionLinkN where N is the ID.
......@@ -280,7 +280,7 @@ function actionlinks_civicrm_tokenValues(&$values, $cids, $job = null, $tokens =
$actionLinkIDs = [];
foreach ($_ as $token) {
$matches = [];
if (preg_match('/^(\d+)$/', $token, $matches)) {
if (preg_match('/^id(\d+)$/', $token, $matches)) {
$actionLinkIDs[] = (int) $matches[1];
}
}
......@@ -307,7 +307,7 @@ function actionlinks_civicrm_tokenValues(&$values, $cids, $job = null, $tokens =
->execute();
foreach ($result as $actionLinkRow) {
$values[$actionLinkRow['contactID']]["actionlink.$actionLinkID"] = $actionLinkRow['link'];
$values[$actionLinkRow['contactID']]["actionlink.id$actionLinkID"] = $actionLinkRow['link'];
}
}
......@@ -316,7 +316,7 @@ function actionlinks_civicrm_tokenValues(&$values, $cids, $job = null, $tokens =
function actionlinx() {
// ------------------------- this sends a message tpl ---------------
// it needs old type tokens like {actionlink.1}
// it needs old type tokens like {actionlink.id1}
$from = CRM_Sos_Utils::getFromEmailAddress();
$params = [
'id' => 178, // put in a valid message template ID.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment