Skip to content
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

Placeholder values cannot be processed by snippets/output filters (in mailing templates) #59

Closed
mindeffects opened this issue Sep 25, 2017 · 3 comments
Assignees

Comments

@mindeffects
Copy link

mindeffects commented Sep 25, 2017

Inside a mailing template, this "made up" test delivers a strange result:
[[+gender:cat=` like wine.`:replace=`Women==2`]]

For a female recipient one would expect this result:
Women like wine.

But that's not what happens! This is the result:
2 like wine.
The output filter does not have access to the the placeholder!?

When using a custom output filter – or a snippet with [[+gender]] as a property – and looking at the var with var_dump or print_r you get this result:
string[11] = 2

It took some time for me to figure out what this means: [[+gender]]has 11 chars! (Thanks, @Mark-H).
At the time, when the placeholder should get proccessed by the snippet or output filter, its value is not rendered yet! Which makes it's impossible to do any stuff with its value.

But I need to process the gender in order to generate a propper salutation. And I cannot do that right now. Or can I?

@mindeffects mindeffects changed the title Placeholders with snippets/Output filter don't get processed in time Placeholder values cannot be processed by snippets/output filters (in mailing templates) Sep 25, 2017
@gadgetto
Copy link
Owner

Just did a quick test with the following tags inside a mailing template:

[[+gender]] = 
[[+gender:is=`1`:then=`male`:else=``]]
[[+gender:is=`2`:then=`female`:else=``]]

It correctly renders:

1 = male or 2 = female

(I didn't test this with a snippet or custom placeholder)

@gadgetto gadgetto self-assigned this Sep 25, 2017
@mindeffects
Copy link
Author

OMG, I think I know what happend: When TESTING a mailing, everything works fine, but NOT when VIEWING, because VIEW does not come with any user data! And I used VIEW because debugging is way simpler and faster than sniffing through the mail body. So, me dumb. Sorry.

Maybe GoodNews could use the current users data for VIEW? This way the admin could easily change his own GoN-settings and look how that affects the output.
This is a FR, right? ;-)

Thanks for your help, @gadgetto!

@gadgetto
Copy link
Owner

You are right, this is definitely needed!
Already filed as feature request:
#44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants