Closed (fixed)
Project:
Simplenews
Version:
8.x-2.x-dev
Component:
Documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Oct 2019 at 12:37 UTC
Updated:
5 Aug 2020 at 15:43 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nchase commentedsame for 8.x-2.x-dev. There is no access to the additional fields created at admin/config/people/simplenews/settings/subscriber that can be filled by Anonymous subscribers.
Comment #3
vistree commentedYes, I am also having this problem. How to use extra user fields in Newsletter text fields? Would be absolutly cool to be able to use them ;-)
Comment #4
nchase commentedUse case for me is: Personalizing the newsletter with for example the name of the anonymous subscriber.
Comment #5
vistree commented@Nchase: same for me ;-)
Comment #6
adamps commentedThanks for the report - it's a bug.
The problem is that the entity type in Subscriber.php is
simplenews_subscriberbut the token type in simplenews.tokens issimplenews-subscriber- one with underscore and one with dash. This means thatfield_token_info_alter()doesn't add the field tokens. The fix is to add code as below to Subscriber.php at the bottom of the comment @ContentEntityType.Same problem for newsletter.
Comment #7
nchase commentedadding it like:
doesn't change a thing. The tokens are not available.
Comment #8
adamps commentedThe comments are effectively code so it has to be done exactly right, like this. Hopefully someone can make a patch soon - the hard work is done which was to figure the cause.
Comment #9
nchase commentedAdamPS, thanks for pointing this out. It works perfectly!
Comment #10
adamps commentedComment #11
adamps commentedThis is a simple one-line change that fixes a problem hit twice recently. It's the sort of change that feels not very easily accidentally broken in future. So I think it is worth committing without tests.
Comment #13
adamps commentedComment #15
cuman commentedIf token is empty it have to be hide
but now it inserts in the newsletter as is [simplenews-subscriber:field_first_name:value]
Token_filter modul lets hide empty token, but token_filter processes token before newsletter sending