-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Contact tokens in welcome email using TokenProcessor #24235
Conversation
(Standard links)
|
$text = CRM_Utils_Token::replaceWelcomeTokens($text, $group->title, FALSE); | ||
|
||
$tokenProcessor = new \Civi\Token\TokenProcessor(\Civi::dispatcher(), [ | ||
'controller' => __CLASS__, | ||
'smarty' => FALSE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also specifiy 'schema' => ['contactId']
here as best practice
Yes this looks great - ideally the I think the way we would do it is
|
@eileenmcnaughton I think it is too complex for me to do what you are asking ....maybe we do this in another PR? In welcome email I'd also like to replace action tokens using
But I would have to use this instruction I took a look at "Resubscribe.php" and there in addition it is called |
@masetto - yes I think it's fine for the scope of this PR to just be replacing those |
@eileenmcnaughton I would have finished and I just replace |
@eileenmcnaughton, my changes cause a regression 😢 : in
since
It does not seem appropriate to re-introduce this code, because anyone would wonder what it is for. I have not checked but maybe 'getTokens' does something else... |
@masetto is the regression that |
@eileenmcnaughton I had a mistake: the |
@masetto hmm - so the hook wasn't working before - is it an issue for you for it to work? Otherwise if it wasn't working I'd just let it drop it (since we still have more cleanup to get that code off the other tokens in that lot & it would be easier not to work around that hook if it never worked in the first place) |
@eileenmcnaughton Now the hook works and I think it's fine 😛 But if you want I can do another PR after you merge this one. |
@masetto that's fine - it can stay as it is - are you happy with this now / ready to remove the WIP |
Looks good - great improvement |
@masetto I took a look at the last place with the |
We really should add an api for this stuff - there is the |
OK - I updated ^^ with what I think will work to use the right template AND call the hook.... |
Oh, great! Now we could also adapt these classes to use |
Overview
Add the possibility of using contact tokens in the welcome email
Before
In the welcome email contact tokens can not be used.
After
In the welcome email contact tokens can be used. For example:
Technical Details
Add new token processor.
We continue to uses
replaceWelcomeTokens
because I don't think it is possible to replace them using token processor.Note
This is a partial pull request. I would like to understand if it is OK the way I did it. Then it would be replicated for
Resubscribe
,Subscribe
,Unsubscribe
messages.