Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a follow-up to #1101616: Friendlier tokens:
In one of my views-send-enabled views, I have two tokens for the same replacement: [field_profile_full_name-raw]
(from "CCK computed_field tokens") and [views-send-field_profile_full_name]
. The first one works properly, but the second one will be replaced by an empty string.
Comment | File | Size | Author |
---|---|---|---|
#11 | views_send-token-replacement-1636036-11.patch | 1.17 KB | hansfn |
Comments
Comment #1
hansfn CreditAttribution: hansfn commentedWhat formatting have you chosen for the full name field in the view? What type of CCK field is it? Does it happen if you output it unformatted too? (Is it fetched through a relation or directly from the node/user.)
I tried to reproduce it myself, but failed...
Comment #2
roball CreditAttribution: roball commentedThe field is of type "Computed" (provided by the Computed Field module). The Computed Code is
and the Display Format is
field_profile_first_name and field_profile_last_name are simple text fields.
The Format of the field in the View is set to "Raw".
Thanks for looking into this issue.
Comment #3
hansfn CreditAttribution: hansfn commentedThe lack of feedback is caused by me being on vacation.
I'm not surprised that a Computed Field field doesn't work. I'll have to look at this after my vacation - in the beginning of August. I of course accept patches ;-)
Comment #4
roball CreditAttribution: roball commentedThank you for looking into it after your vacation. I can ensure that the same Computed Field field did work in an earlier devshot of Views Send, but stopped to work some times ago (don't know with which change, however).
Comment #5
hansfn CreditAttribution: hansfn commentedComment #6
hansfn CreditAttribution: hansfn commentedHm, I just tested with a computed field named field_computed and the token replacement just worked. (I assume you have checked the "Store using the database settings below (required for Views use)" for the field?) Maybe flushing the cache helps? Or maybe you have some other modules causing problems?
If you use the devel module, you can add
in the beginning of the function views_send_mail_action (for example around line 315) to see what tokens Views Send know about and what info Views Send gets from Views. Please post the output here.
Comment #7
hansfn CreditAttribution: hansfn commented@roball: Is this problem still present in the latest dev version (2012-Aug-16 or newer)?
Comment #8
roball CreditAttribution: roball commentedWith beta1,
[views-send-field_profile_full_name]
will still be replaced by an empty string, so, yes, the problem is still present.dpm($context['views_send_tokens']);
gives
so there is actually nothing being replaced.
However,
dpm($context['row']);
works - it gives
Comment #9
hansfn CreditAttribution: hansfn commentedHi, roball
It's a little bit annoying that you didn't test this when I asked back in August. The beta1 was released because this and similar bugs should have been fixed for good. Apperently they weren't.
Anyway, your dpm output above is correct/perfect. $context['views_send_tokens'] doesn't contain the replacements - just the tokens and keys. However, I see now that the fix I applied to
_views_send_get_fields_and_tokens_views_send_get_from_views_result wasn't duplicated to views_send_mail_action. I'll be back tonight with a fix. Being confident now ;-)Comment #10
roball CreditAttribution: roball commentedSorry for reporting back too late - will try your fix asap.
Comment #11
hansfn CreditAttribution: hansfn commentedI'm 99,99% sure that the attached patch will solve your problems. Please test.
Comment #12
hansfn CreditAttribution: hansfn commentedFixed in commit 1d98b38.
Comment #13
roball CreditAttribution: roball commentedYeah, I can confirm that it finally works with 6.x-1.0-beta2. Thanks for the fix!
Comment #14
hansfn CreditAttribution: hansfn commentedThx for confirming. I'm closing this now.