In the current configuration, I have set up an email notification when content is flagged. I also have a user-account field "name" and "firstname" that I want to use in the automated email. Hence, I use this as my mail body in the rules action:
Dear Coordinator,
Mr. [flagging-user:field-name] has reserved a table.
[flagging-user:field-name] does not get replaced at all, while [flagging-user:name] yields the user name. Are profile fields not supported?
kind regards,
David
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | flag_1304790.patch | 876 bytes | drewish |
| #2 | flag_user_global.patch | 473 bytes | fago |
Comments
Comment #1
quicksketchUpdating title for accuracy. I haven't tried to use the flagging-user token in Drupal 7 yet, but if [flagging-user:name] works then it should work for all Field module fields also.
Comment #2
fagoThey are. I guess though the problem is that the global user object is taken, which is no full entity. Attached patch should fix it, please test.
Comment #3
fagoComment #4
quicksketchAh right. I actually just ran into this earlier this week that the global $user is not a full entity. Thanks for the patch, I imagine it should work, but if @dkliewer can confirm that would be great.
Comment #5
joachim commentedComment #7
drewish commentedLooks like the code has moved into flag_flag.inc but the fix still works. Here's a re-roll.
Comment #8
drewish commentedComment #9
joachim commentedThanks for the reroll. Committed to 3.x.
Comment #10
joachim commentedFixed on 7x-2x too.
Comment #11
joachim commentedHmmmmm hang on.
This is adding a full user_load() right at the top of the process, for tokens we might or might not need.
Would it not be better for performance to leave this off until Rules is invoked (if it exists)?
Similarly, when we replace our own tokens for our own labels, we lazy-load the flagging entity:
Should we not take the same approach for the user here?
Comment #12
joachim commentedHmmyup, on further reflection, I'm not happy with this fix. I don't think it's a good thing to be adding an extra entity load to the flag pathway, which is used on AJAX.
Reverting the commits.
Comment #14
ivnishDrupal 7 is EOL. Issue will be closed, but patches are still here