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.
Hi,
In function views_send_mail_action
can the logic be changed so that tokens are processed before eventual php evaluation? I think this way is easier to access the necessary fields of the view.
Vitalie
Comments
Comment #1
hansfn CreditAttribution: hansfn commentedWhat is the issue here? What doesn't work?
Comment #2
vitalie CreditAttribution: vitalie commentedI have these fields in the view: title, firstname, middle initials, lastname, sufix and some may be empty. I want to start my message as 'Dear title firstname middle initials lastname suffix', but I do not want to have two or more spaces (in case a field is empty).
I find that it would be easy for me to use some php to test if a field is empty or not, but at the same time to get the value of the field from the tokens. However, I think that the order of parsing is first evaluate php, then evaluate tokens and thus $test = '[views-send-field_firstname]' is always not empty. On the other had, if the token would be first evaluated and the value would be empty, then $test='' and when php is evaluated it would rightly see that it is empty.
I hope this is clearer.
Comment #3
hansfn CreditAttribution: hansfn commentedThx, that made it clearer. If I don't find any reason for the current order, I can definitely switch it. Your use case makes a lot of sense.
Comment #3.0
hansfn CreditAttribution: hansfn commentedSorry, mistype.
Comment #4
vitalie CreditAttribution: vitalie commentedHi, so what do you think about switching the order? Since then, I've had other uses cases. For example, I've been using views_send to send messages that contain a one-time-login link to certain users. It's very easy to do it with the order I suggest. This applies to Drupal 7 version as well.
Comment #5
hansfn CreditAttribution: hansfn commentedMoved to D7. No more new features for the D6 version.
Comment #6
hansfn CreditAttribution: hansfn commentedSorry, but I don't see that I will have time to fix any D7 issues.