I'm using the actions module with the workflow module. I'd like an email to be sent to the author of the content when it gets published. Am I missing something obvious that would let me do this?

Comments

jvandyk’s picture

You're just missing an action to do that. The action_send_email action in actions.inc could easily be modified into another action called "Send Email to Node Author".

Steve Dondley’s picture

OK, so it will take a hack of the module then? I want to be sure that the feature isn't already there and I'm not missing something obvious.

Thanks.

jvandyk’s picture

It wouldn't be a "hack of a module", it would be another action. The real solution to this is to introduce a variable language into the config screens so you could say {author} in the send email to field. But I haven't got time for that right now. You might want to look at the patch by samo.

Steve Dondley’s picture

Assigned: Unassigned » Steve Dondley
Status: Active » Needs review
StatusFileSize
new2.72 KB

OK, I've made a modification to the actions.inc module. See attached.

It's operation is pretty straightforward. You set the recipient to "author" if you want to have the email sent to an author. (Oops, just realized I should have enclosed 'author' in the t() function).

I also improved the functionality of the message so you can send variables in it (like %site_name, %user_name, etc.).

Steve Dondley’s picture

StatusFileSize
new2.62 KB

OK, here's a revision to put the word "author" in a t() function and gets rid of a couple of superfluous lines I found.

Steve Dondley’s picture

StatusFileSize
new2.62 KB

Sorry, let's try that again. Last patch is bad. This should work.

jvandyk’s picture

So now we have differing suggestions for variable replacement:

- samo: [[title]]
- sdondley: %node_title
- jvandyk: {title}

We want to have a variable replacement strategy that is easy to understand, easy to type, and is as standards-based as possible. Mine is probably out because curly brackets are used in Javascript.

Steve Dondley’s picture

Well, the %format is used by the user.module. I think we should go with whatever is in the core.

merlinofchaos’s picture

% substitution is used most widely in Drupal, that I remember.

jvandyk’s picture

Status: Needs review » Closed (fixed)

Committed.