Closed (won't fix)
Project:
Drupal core
Version:
7.x-dev
Component:
other
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Nov 2008 at 22:23 UTC
Updated:
9 Oct 2012 at 14:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
meba commentedComment #2
gábor hojtsyLooks like a straight port of the actions.module patch. Looks good.
Comment #3
joshmillerThis patch needs to be committed for D6 and D7, preferrably on the next security iteration of D6...
As far as I can tell, without this patch, workflow can't send emails or post messages with %node_title or %author. I'd prefer to not hack my D6 core by applying this patch, but I might have to.
Josh
Comment #4
meba commentedBugs are usually fixed in HEAD, then backported to stable. If you want to speed up the time, encourage more reviewers.
Comment #5
scottrigbyI reviewed in D6, and it solves the problem that this bug caused for workflow emails. Great work :)
Comment #6
alexanderpas commentedComment #7
neoprog commentedDrupal 6.8 dosen't repair this bug !
The patch works whit D6.8
But i have * beford and after token in the mail !
Exampel :
Comment #8
alexanderpas commentedComment #9
stevenpatzWas this reviewed and tested on the 7.x branch?
Comment #10
cjd400 commentedi patched and it nearly worked ... All the fields work and it now emails the author using %author. BUT if I use %author in the email body I get literally "%author" and the text isn't replaced with the authors name. Yet %teaser, %body, %node_url all work fine - I'm really confused. Anyone else had the same prob?
Thanks for the patch though at least I can now email from workflow - great :)
Comment #11
cjd400 commentedsorry - appears I was being a little thick - you can't use %author in the body you have to use %username - doh! :)
Comment #12
gábor hojtsyAs said in #4, this issue (as well as other bug reports in Drupal 6) first needs to be fixed in the Drupal 7 branch and will then be backported to Drupal 6. Only if the change is too different in Drupal 6 and 7 should we have two separate issues, otherwise Drupal 7 should get the fix first.
Comment #13
meba commentedComment #15
arnoldc commentedWhat's the status of this for D6? In my opinion, this is critical as it makes workflow useless.
Can someone paste the necessary changes here as I don't use patch..... Thanks.
Comment #16
arnoldc commentedOkay, I implemented the hook_mail_alter() in my own module to work around the current issue on hand. No hacking to the core codes. This is for D6 and I restrict it to be used with Workflow only.
Comment #17
Bob Stein commentedThis will be the first time I've ever tried manually copying and pasting a patch into a Drupal module, so please forgive me if these questions are rather basic.
1. In the line "function YOUR_MODULE_NAME_mail_alter..." do I need to replace "YOUR_MODULE_NAME" with something more specific, or do I paste exactly as written?
2. Just to be clear: precisely WHICH file am I to copy this code into? I assume it is trigger.module, but I didn't want to find out the hard way that it should go somewhere else.
3. Does it matter WHERE in the file I copy this text? At the very end? In the middle?
Thanks very much for any help.
Comment #18
arnoldc commentedNo, you don't touch the core code. You put it in a separate module and enable it to override the function.
Anyway, I have attached the zip file. Simply uncompress it and copy the folder to your site folder (e.g. /sites/all/modules/) and enable it in the admin panel.
When core Drupal fixes up this bug, you can simply disable and remove the module.
This module adds a new token named '%authorname' to display the author's user id and is currently restricted to use with Workflow action only.
Comment #19
Bob Stein commentedThanks, arnoldc. I installed your fix as a module and enabled it, and then tried moving some content through different Workflow status, but the results were the same: tokens in the resulting system-generated emails were still showing as %node_type, %title, and so on.
Comment #20
arnoldc commentedNot sure why. Try removing the IF statement to check for "workflow" in the codes to see if it helps. Or try to set the weight of this module in the System table to a big number like 10 instead of the default 0 using a database tool like phpMyAdmin. If that still doesn't work, try add an echo statement right at the top of the function to see if this function is actually invoked during email notification.
Comment #21
Bob Stein commentedMy PHP skills are admittedly rather feeble, but I still wasn't able to get results with this. Thanks for your help, though--much appreciated.
Comment #22
ernesto.allely commentedI tried apply the patch with some changes to workflow module and apparently it runs. (at the end of workflow.module)
What do you think?
Comment #23
meba commentedPLEASE, do not change version of this patch. Patches are first committed into HEAD, then backported into D6.
Comment #24
ernesto.allely commentedSorry, i'm newbie in this forum, It was not my intention to make the change.
cheers.
Comment #25
Bob Stein commentedI pasted Ernesto's version onto the end of workflow.module, and it fixes the problems. But it duplicates the subject line in the system-generated email. For example...
What the subject line should be: Email subject line
What the subject line is with Ernesto's code: Email subject lineEmail subject line
Comment #26
Bob Stein commented...and upon further testing, it appears that the Ernesto's fix only works on certain workflow states. Example...
I have three Workflow states: draft, submit for review, published
When content is created by a reporter and saved as "submit for review," the correct actions are now triggered (along with the aforementioned "double email subject line").
But when the editor accesses the content and moves it to Workflow state "published" the correct workflow actions are not triggered.
Also, when the editor moves content from "submit for review" back to "draft" for more work by the reporter, the workflow actions are again not triggered.
I'll keep working on it.
Comment #27
meba commentedIt's useless to produce "modules" for this. Just help fixing this in core (resubmit the patch)!
Comment #28
Bob Stein commentedI think meba's right. Unfortunately, all I can do is offer testing support and feedback.
Comment #29
ernesto.allely commentedHello, first of all thank you for the feedback.
Indeed, it was an error in the code in the message creation.
You can see that the message it's been adding and not replacing.
I try to reproduce the bug in #26 but for me it runs well y any cases.
ProfStein, can you give me more information to try to reproduce the error?
If i can do something more to correct the bug i'll try to dedicate more time.
cheers.
Again, the modified code:
Comment #30
Bob Stein commentedOkay I've done more testing of Ernesto's code from #29. It fixes the "double email subject line" bug.
Also, I think I've isolated the other problem I described in my earlier posts. It seems that %author is not being picked up from the Recipient line in the "Configure an advanced action" menu (that's in Home-->Administer-->Site configuration-->Actions). The instructions beneath the Recipient field state: "The email address to which the message should be sent OR enter %author if you would like to send an e-mail to the author of the original post." But the %author hook doesn't get picked up--it only works if an actual email address is entered in the Recipient field. When I enter an actual email address instead of %author, the actions all are triggered and carried out as they should be.
EDIT: Ernesto, it seems that %author isn't included in your "$variables = array" so it makes sense that it wouldn't be called. I tried to include an %author line, but as I mentioned earlier, I'm just not familiar enough with Drupal coding (yet) to make it work.
SECOND EDIT: I think I fixed the %author issue. Here's the code now, using Ernesto's work and a couple pieces of arnoldc's work.
Comment #31
Dave Hirschman commentedSubscribing.
Comment #32
Richard Blackborder commentedThere doesn't seem to be a hook_message_alter. Is a temporary fix for displayed messages possible, or will that only come with the core patch?
Comment #33
jonbates commentedI've entered ProfStein's code and it seems to work, although the email message is being re-written on one line (HTML breaks are ignored). I'm a PHP newbie. If there something in the above code that would cause this?
Any news on when the core module will be fixed?
Comment #34
egbertb commentedAgreeing with meba with this addendum: As long as the core ain't fixed, I am very happy with a temporary solution.
Although the solution for the messages would be very welcome.
Comment #35
hoyer commentedSubscribing
Comment #36
kepford commentedSubscribing
Comment #37
Anonymous (not verified) commentedI would be grateful if someone who got this working could explain to a non-programmer which bits of code have to be pasted in which files to enable Workflow to honour the use of %author as the email recepient. I've enabled arnoldc's module work around from #18, but after that I get lost with the further code developments through the thread. Does one of them replace the code in arnoldc's module or is one of them added to the end of the workflow.module? Thank you in anticipation! I'm implementing in Drupal 6.13.
Comment #38
ndame commentedI'm in the same boat as mclsm--I would love to implement this patch but I got lost in all the code talk.
Could someone possibly post an updated fixed module possibly for us uneducated folks to use?
Thanks and great work--look forward to this getting added to core.
Comment #39
Richard Blackborder commentedThis is what I did. You should test it out before doing it on a production Drupal site:
Comment #40
robokev commentedThis appeared to fix the mail issue for me (in D6), but I notice the problem remains with the "Display a message to user..." system action. So I guess the issue is more systemic.
Comment #41
Bob Stein commentedIn response to a couple of you who were looking for a less technical explanation of what to do with the code from #30, I want to make sure you saw Likeless's explanation in #39. He's got it right. I'll emphasize that you do NOT have to replace any of the code in the existing module; just paste #30's code onto the end of what's already there.
It's been pointed out (here and in a couple other threads) that this isn't really a complete fix yet, and that's true. But depending on what your needs are, #30 will get you through until the root problem is (hopefully) fixed in core in Drupal 7.
EDIT: Here's the other thread that has dealt with this issue a lot, if you want to read more about it: http://drupal.org/node/253711
Comment #42
ggevalt commentedThanks to all who added to this thread -- we now have workflow notifications functioning on our site thanks to the patch by ProfStein in #30 and the great instructions by Likeless in #39 (sorry for the mis-type previously!)
Just an observation on the patch:
The action shown in our recent log entries still states only "action 10/12/2009 - 4:15pm Sent email to %author". The email is sent to the correct email, but that email is not displayed in the same way as other system action notifications display (emails sent by triggers not related to workflow display the email of the author, workflow triggered actions display only %author). You can, of course, find out who the author is that has been emailed by visiting the node listed in the details of the log entry, so this is really a "minor" issue but it threw me for a moment when I went to check whether all was working as it should be.
Again -- we're very happy that this patch worked for us and appreciate all the effort you each have put into finding a temporary solution for the issue!
Comment #43
Bob Stein commentedInteresting feedback, ggevalt. Do you mind indicating precisely where you're seeing that action log entry? Is it in "Reports-->Recent log entries"? I'm guessing it is, but I don't want to hunt around for stuff in there in case you're seeing it somewhere else.
Comment #44
ggevalt commentedYes,
I was referring to the logs located at admin/reports/dblog (Reports -->Recent log entries).
Also, after further investigation I've noticed that when the emails are sent, %username in the text of the generated message is replaced with MY username and does not fill in the appropriate user's username. In other words, the system should be sending an email to Sarah using Sarah's username: "Sarah, congratulations! Your entry has been ...." Instead, the message Sarah receives is as follows: "ggevalt, congratulations! Your entry has been....." The %author variable does find the correct email and Sarah does receive the notification, but I'm unsure of why she receives my name in her email instead of her own. Should I be using a variable other than %username?
The text under the Message field states "The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts." -- is this altered by using the patch above?
I've temporarily fixed this by deleting the %username -- all other variables in the Message are functioning properly.
(Also, emails generated outside of workflow do fill in the appropriate name, so it appears that it is a workflow related issue...I think?)
Even with these hiccups, our users are receiving notifications for the first time in a few months and we are quite happy with the temporary fix. Thank you!
Comment #45
Bob Stein commentedOkay, I see what you're saying. I believe the %username is the name of the person sending the email (i.e., you), not the username of the recipient. I'll see if I can come up with something that would pull the name of the recipient (probably a variable to be called %recipient).
I'm looking at the %author issue. I've replicated the problem you describe, so hopefully I can track that down soon.
Comment #46
optidel commentedIf you are like me and do not like to modify core or any of the contributed modules, you can enable the module "Token Actions" module which is part of Token module. This adds a few more actions to the actions drop down like "Send Tokenized Email". The tokens in these new actions are working for me.
Comment #49
tqvn2004 commentedSubcribing
Comment #50
mennonot commentedThe instructions in #39 worked for me in 6.x once I figured out that I needed to use the "Send e-mail" action and not the "Send tokenized email" action.
Comment #51
mennonot commentedWhen I added the patch from #30 to the workflow module in 6.x and got the following error:
Fatal error: Cannot use string offset as an array in .../sites/all/modules/workflow/workflow.module on line 1640Comment #52
Anonymous (not verified) commentedI'm going to guess this is a won't fix for D6, since D6 commits focus on security fixes at this point.