We setup a flag with flag fields, and enabled on a node. We then set an action to send an email when the node was flagged. The admin screen for creating the action shows flagging:field type tokens available, but they are not replaced when the email is sent. Looking in the action code it appears that flag_actions_flag_flag receives the flagging entity, but does not pass it on to flag_actions_do, because there is no parameter available in flag_actions_do. With this patch I add an optional flagging parameter to flag_actions_do that defaults to "FALSE", then if that parameter is passed in I add it to the context array for token replacement. Seems to fix it for me.
Comment | File | Size | Author |
---|---|---|---|
#5 | flag_action_flagging_fix_2269103-5.patch | 1.93 KB | bulldozer2003 |
| |||
#2 | flag_action_flagging_fix_2269103.patch | 1.46 KB | ryan.wyse |
flag_action_flagging_fix.patch | 1.18 KB | ryan.wyse | |
Comments
Comment #1
joachim CreditAttribution: joachim commentedThanks for the patch.
(I'm surprised anyone is still using actions rather than Rules...!)
You should make the same change to flag_actions_flag_unflag() to be consistent.
The default should be NULL rather than FALSE.
Also, I've no idea if this is something that other modules might feasibly call, so I'm not sure if the default is needed.
Check code formatting here.
Comment #2
ryan.wyse CreditAttribution: ryan.wyse commentedHere is an updated patch. I dropped the default and the check for it, since you think its unlikely flag_actions_do would be in use anywhere else. And added in the unflag change.
Comment #3
cs_shadow CreditAttribution: cs_shadow commentedMarking for review, though lgtm at a first glance.
@ryan.wyse, remember to set the status to 'Needs review' whenever you submit a patch. It serves two purposes:
1) Triggers the test bot.
2) Reviewers get to know that there's a patch that needs review.
Comment #4
timlie CreditAttribution: timlie as a volunteer commentedThanks for the patch, works for me!
Comment #5
bulldozer2003This patch adds the flagging object to the trigger context as well.