Closed (fixed)
Project:
Workflow
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 May 2008 at 22:35 UTC
Updated:
2 Jan 2014 at 23:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hillaryneaf commentedI found that the other variables do not work either for advanced actions with workflow state changes as well... I created an advanced action "send email" and found only %site_name works, the following do not:
%node_type
%title
%node_url
Does anyone else have this problem?
Comment #2
dirtabulous commentedI'm running into the issue when trying to send mail using actions. Did you ever get this figured out?
Comment #3
hillaryneaf commentedNope, still find any solutions... I just used generic terms instead of the tokens
Comment #4
hillaryneaf commentedI haven't tried it yet.. but maybe this will help? http://drupal.org/node/195773
Comment #5
oriol_e9gI have the same problem: I have tested the same functionality without the workflow module and works fine, but when I enable the workflow module and configure some actions message actions or email actions appear the string %node_url, %node_type, %title %body instead of the variable content.
Comment #6
oriol_e9gI have changed the project because the workflow module include the triggerunlock functionalities.
Comment #7
danieldennis commentedIs this going to be addressed. It seems that sending email is a popular use of workflow.
Comment #8
jvandyk commentedThis is actually a bug in Drupal 6 core trigger module. We should roll a patch for D7 and have it applied to D6 as well.
It was fixed in Drupal 5 actions module (this commit).
Comment #9
hillaryneaf commentedShould this be moved to the D7 queue? or D6 queue?
Comment #10
attheshow commentedI'm having the same issue. I'm unable to send useful emails because of it. Does anyone have a patch for this?
Comment #11
kcpau commentedI have the same problem. Are you saying that triggerunlock will fix it??
Comment #12
hillaryneaf commentedNo, jvandyk is saying it is a bug in the Drupal 6 core that would need to be addressed.
Comment #13
mullman commentedHow do I apply the fix from #8 in my Drupal 6 installation?
Comment #14
adaven commentedsubscribing
Comment #15
mattmackay commentedAre we able to successfully use variables when sending out emails from workflow (as that is a pretty significant chunk of my use case my workflow and drupal)?
Or are we saying that we need to wait for Drupal 7 before it works??
Thanks
Comment #16
adaven commentedI've just submitted a patch for D6 that should fix this issue #339770: system_send_email_action doesn't check context for node. It's pretty much the same as the patch referred to by jvandyk in #8!
Comment #17
meba commentedThe patch is duplicate to #339591: Sending mail and displaying a message in a trigger doesn't honor tokens
Comment #18
adaven commentedlol! beaten to it by a day - nice work though.
Comment #19
oriol_e9gFixed by this: http://drupal.org/node/339591
Comment #20
scottrigbyProposed core patch at link #19 works for D6. It's a shame to have to do this, but sending emails with workflow is kind of important :)
But the more people who test this (probably test in D7 as well) the more likely it will get into the next release of D6.
Comment #22
ernesto.allely commentedI tried apply the patch described in #339591 with some changes to workflow module and apparently it runs. (at the end of workflow.module)
What do you think?
Comment #23
Bob Stein commentedHere is a more complete fix for workflow.module. It can be cut and pasted onto the end of workflow.module and works without having to make any changes to core.
What follows is mostly Ernesto's work, but includes a few lines (from user arnoldc) that make sure %author calls the right information if %author is present in the email action Recipient field rather than a specific email address. More information about this is at http://drupal.org/node/339591
Comment #24
attheshow commentedPatch #23 works really well for me. Great contribution ProfStein! No hacking core. :)
Comment #25
speis commentedthis works great, the only thing is, it doesn't honor any html tags like
or
which kinda screws up my email format message.
Can this be fixed?
Comment #26
smacphail commentedThe HTML tags are being stripped because of the last line:
$message['body'][0] = drupal_html_to_text($body);That function turns any HTML code into a rough approximation of your message but represented in plain text and ASCII.
Problem is, removing that line and making it
$message['body'][0] = $body;won't help. Actions uses Drupal's system mail (see here), which callsdrupal_html_to_text()*again*, so for Action-generated emails, you're sorta stuck with plain text, at least for now.(Also note, if you're like me and just wanted to send normal text emails, there's a problem with the way
drupal_html_to_text()is used with system mail, and it gets greedy (#298708: drupal_html_to_text() removes line endings) with line breaks, turning everything into a single line of text. There's an easy workaround (http://drupal.org/node/298708#comment-1376638) but it involves putting html into your Action. Not great, but it does the job, at least until system mail is modified to not use it. (#407452: Remove use of drupal_html_to_text() from system mails) )Anyways, just confirming that ProfStein's code worked for me, although I removed the drupal_html_to_text() function from my version, because of the greediness, as mentioned above.
Comment #27
Richard Blackborder commentedsubscribing
(thank you Ernesto and ProfStein)
Comment #28
mikeskull commentedAlso getting same issue albeit on sending emails, this is makes workflow unusable for me, tried moving the trigger for the email send closer to the start of the workflow, only the %site_name and %username ones ever work. none of the fixes above work for me either.
Its just a simple workflow of user creates a node once created email gets sent to admin with details of the node. All works fine just have %title and stuff all over the email.
If you need any testing done just shout.
Comment #29
egbertb commentedPatch work for me, thanx.
Still have a comparable problem with the messages set, but there is no alter_message hook.
So now I have correct mails, but still very ugly uninformative messages in the page after saving.
Comment #30
sharplesa commentedAm I missing something? workflow_workflow is calling actions_do with a null $object at line 791.
Can't workflow just go ahead and set $object to $node? Attached is a patch introducing a simple addition that sets $objects[...]=$node iff $objects[...] is still empty after _trigger_normalize_node_context. Works beautifully and does away with the need for the creative patching going on above...
Comment #32
csc4 commentedI'm struggling to understand the context and how to use it - the patch at #30 seems like a good enhancement.
Comment #33
punjabi commentedPatch #30 seems to work great for me.
Comment #34
sharplesa commentedPatch at #30 is simple and solves the issue. Please review and implement.
Comment #35
meba commentedIf the patch works and is already tested, why moving back to need review?
Comment #36
sharplesa commentedBecause the proposed patch seems to do way more than necessary, compared to the very simple patch I proposed at #30. I guess I was requesting that the community who reviewed the previous patch reconsider the work that I'd done and let me know if I'm off-base, or if this isn't a better solution than the previously accepted one.
Comment #37
Anonymous (not verified) commented#30 works for me!
Please implement!
Thanks much!
Comment #38
designerbrent commentedThe patch in #30 works excellent for me.
I'm also elevating this to Critical as it seem that this module is not as useful without this functionality.
Comment #39
jumpfightgo commentedPatch worked for me too on production site, no problems yet (fingers crossed)! :)
Comment #40
WeaveGeek commentedPatch #30 worked for me too. Also on a production site. Thanks!
Comment #41
fschwiet commentedPatch 30 worked for me for both emails actions and user message actions.
I think there was reasonable pushback though as it is too general. It is always applying the node without knowing that is appropriate.
Before the patch, the trigger module uses $action_info['type'] to determine what tokens get replaced with action specific information. In the happy case it is $action_info['type']=='node' and we get the node info. In the case where the patch is applied, the value of $action_info['type']=='system'.
I'm new to Drupal, so not sure where to go with this. I'm going to use the patch in 30 though its been rejected.
Comment #42
tqvn2004 commentedSubcribing
Comment #43
jvandyk commentedModified patch from #30 committed to pass the node if the action type is 'system'. Will appear in 6.x-1.4.