The attached patch adds an action to Workflow NG which makes it possible to subscribe a user to a certain newsletter. You may want to use this functionality for example when your site features a mailinglist and you'd like to automatically subscribe every newly registered user to that mailinglist.
For the newsletter functionality this patch depends on the Simplenews module, but since I don't think everybody would like to use this functionality I decided not to add an extra dependency to Workflow NG. Instead, when the action is used and Simplenews isn't installed, a friendly message is shown to the user indicating that the action cannot be used until Simplenews has been installed.
This patch applies without errors on the 5.x-1.x-dev version as well as on the 5.x-1.0 version of Workflow NG. However, I've only tested it with the 5.x-1.0 version.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | simplenews_action.zip | 2.57 KB | sutharsan |
| #13 | simplenews_action.zip | 2.3 KB | sutharsan |
| #9 | simplenews-workflow_ng-integration.patch | 2.4 KB | rkj |
| #6 | workflow_ng_simplenews.tgz | 1011 bytes | rkj |
| #3 | workflow_ng_actions.inc_.subscribenewsletter_0.patch | 2.68 KB | rkj |
Comments
Comment #1
fagoA great idea! However the way it is supposed to work, is that simplenews modules implements that action. For that it doesn't need a dependency on worklfow-ng, just implement hook_action_info with simplenews and add your action to it.
docs about this topic: http://drupal.org/node/156754
That would be great as one could auto-register people to newsletters e.g. by role :)
Comment #2
yngens commentedsubscribe
Comment #3
rkj commentedAllright, thanks for your reply, fago. Maybe I'll post a patch for Simplenews later.
For those who would like to use this patch for workflow-ng anyway: I've discovered a small typo, so attached you'll find an updated version of the patch.
Comment #4
geek-merlinsubscribe
Comment #5
geek-merlinhey there, i wrote a .inc file for the send action at #219544: Actions to do scheduled sending, you might use/extend this.
Comment #6
rkj commentedSince workflow-ng 5.x-2.0 has a new modules/ directory for workflow-ng integrations with the various modules, I figured this patch should be rewritten as .inc files that can be put in this modules/ directory. Is this correct, fago?
Anyway, attached you'll find a tarball containing two .inc files that make this functionality work in the new 5.x-2.0 version of workflow-ng.
Cheers,
Remco
Comment #7
fagono, that's only intended for core modules.
contribs should ship with their own integration, so please create a patch for simplenews instead.
Comment #8
rkj commentedOkay, no problem. Here it is.
But why then did you include token integration in workflow-ng's module directory? AFAIK, this isn't a core module...
Anyway, I hope the maintainer of simplenews will include my patch in the next release.
Comment #9
rkj commentedOkay, no problem. Here it is.
But why then did you include token integration in workflow-ng's module directory? AFAIK, this isn't a core module...
Anyway, I hope the maintainer of simplenews will include my patch in the next release.
Comment #10
fagogreat, to see you working on this. the token.inc is just for worklow-ng's additional token support (workflow-ng token API) and no usual module integration.
* your functions have partly the wrong namespace:
e.g. workflow_ng_action_subscribenewsletter should start with simplenews or better simplenews_workflow_ng or so.
* you shouldn't have the checks for the existance of simplenews - as the code is shipped with simplenews if it's added.
*+ foreach (taxonomy_get_tree($vid) as $n) {
use more readable variable names than $n.
Comment #11
scottrigbyHi Fago (hi rkj) - I'll be happpy to test this out once I know what I should test. Thanks guys! -Scott
Comment #12
scottrigbyany news? :)
Comment #13
sutharsan commentedI've combined the rkj's code and aexi's code (http://drupal.org/node/182218#comment-818537 and http://drupal.org/node/219544#comment-826871) into one simplenews submodule for workflow_ng integration.
I hardly tested the code but the basis of rkj and aexi looks good enough to give it a try (even for non coders amongst you).
Comment #14
sutharsan commentedThis title is more appropriate.
The patch only takes care of workflow_ng integrations. If there is interest for actions integration, pls let me know.
Comment #15
socialnicheguru commentedThis is great thanks!
Chris
Comment #16
fagoI had a short look at the code without testing it. There are two forgotten var_dumps() in there, apart from that the code looks fine.
Comment #17
scottrigbyHi guys, has anyone taken care of the forgotten var_dumps() fago mentioned - and if so can you post the updated code here?
By the way, could this (for example) allow workflow_ng to send email notifications when new users subscribe to the newsletter?
Cheers!
:) Scott
Comment #18
sutharsan commentedvar_dump() removed. New zip file attached.
@scottrigby: no, in only includes actions to subscribe a user and to send a newsletter.
Comment #19
lonehorseend commentedI just downloaded and tested this on a new installation of Drupal 5.16. The subscription part works great! The sending part not so well because it seems incomplete. I'm not give a choice of what email to send, so it attempts to send the user's bio (the node has been created and being tested byworkflow-ng) instead of an actual newsletter issue.
I guess it would be fine if I created a newsletter and wanted it sent, but I really want to send a particular newsletter based on the fact that a person just created a their bio. I'm using simplenews because it's the only way I've researched that seems to send attachments.
Comment #20
lonehorseend commentedForgot to set the version that I'm using.
Comment #21
miro_dietikerClosing all feature requests of 5.x.