Hi,

i have written a workflow_ng integration.

it implements the privatemsg hook and allows to interact with workflow_ng. There is one default configuration provided: When userA sends a pm to userB, userB get a configurable mail. Any other actions can be easily created via workflow_ng UI.

It´s an own module, but i think, this is the right place for it.

regards

Comments

Zen’s picture

Status: Reviewed & tested by the community » Needs review

Authors aren't supposed to set patches to RTBC. Somebody needs to review them first.

nodestroy’s picture

StatusFileSize
new10.55 KB

i have extended the module with an workflow_ng action to send privatemsg´s

fago’s picture

Status: Needs review » Needs work

it looks good, however I found some issues:

* you forgot to place //$Id$ in your file
* use the @file doxygen for documenting the whole file
* includes: use the whole path for including. Without some people will have troubles.
* function pm_workflow_ng_action_send_privatemsg has bad coding style. add a space before {, furthermore it looks like there are tabs in it.

* when you invoke the event, you previously load the users. this is not good, as they will be loaded whether they are needed or not. Change them to be loaded by a handler, so they are loaded only when used.
* so why do you invent $privatemsginfo ? Why not just pass $message to workflow-ng and add token support for that?

Then why do we add this as a separate module?
Couldn't we implement privatemsg_privatemsg() too? Then we could add this is as an include file, that is automatically included when workflow-ng is activated. -> More user friendly.

We could also add a new include file for the default configuration and let it workflow-ng include through hook_module_info (only when necessary!). Lookup workflow_ng_module_info() as example. This would probably make more sense than the action include, but it would only work with w-ng 2.x, but I don't think that matters really.

nodestroy’s picture

Status: Needs work » Needs review
StatusFileSize
new11.8 KB

thanks for your review.

* added $Id$
* improved documentation with @file comments
* whole path for including
* cleaned coding style issues
* handler for arguments (i´m not really sure if the message handler is needed...please report if don´t)
* used message and added token support

i think its more flexible with an own module, due to it comes with privatemsg module, its just a click to activate it

fago’s picture

great, code looks good now. You can remove the message argument loading handler, if you move the message argument to be the first entry in the #arguments definition. If there is no handler, it will just use the first passed variable - the message.

I still think, it's unnecessary to be its own module. E.g. the token integration might be useful also for people which don't use workflow-ng. And yes, it's just one click to activate, but it's an unnecessary click. However, I think this has to be decided by the module maintainer anyway ;)

nodestroy’s picture

StatusFileSize
new11.61 KB

now without extra handler for message

fago’s picture

Status: Needs review » Reviewed & tested by the community

great!

alexkoe’s picture

Thank You for great work.
But i see that token integration does not work.
I debugged it and found that function pm_workflow_ng_action_send_privatemsg should be as follows. Then tokens work well.

/**
* Sends the Privatemsg
*
* @param $user_rep
* Recipient of the Message
* @param $user_sen
* Sender of the Message
* @param $settings
* Associative Array with 'subject' and 'message' as keys
*/
function pm_workflow_ng_action_send_privatemsg($user_rep, $user_sen, $settings,&$arguments) {
// send pm
+ extract( workflow_ng_token_replace_all(array('message', 'subject'), $settings, $arguments, $log) );
+ _privatemsg_send($user_sen, $user_rep, $subject, $message, FILTER_FORMAT_DEFAULT);
- _privatemsg_send($user_sen, $user_rep, $settings['subject'], $settings['message'], FILTER_FORMAT_DEFAULT);
}

Bencoon’s picture

It works exactly as needed, with the alteration from Alexkoe. Thank you *so* much for making this, this helps immensely. :)

For the include that sends a private message, is it possible/convenient to add support for adding and having the message sent to a specific sort folder?

webchick’s picture

Status: Reviewed & tested by the community » Needs work

based on #8/#9

nodestroy’s picture

Status: Needs work » Needs review
StatusFileSize
new11.68 KB

new patch attached

fago’s picture

Category: feature » task
StatusFileSize
new4.06 KB

hm, I created some rules for testing each part of the configuration.

First off, when I deleted a pm my rule created that message:
* PM event "Message is deleted" occured for a message of subject and sender user Anonymous and receiving user fago.
Then I when I pruned a message out of the trash, the delete message was shown again. So the delete event occured instead of the prune event.

However looking at the patch, it looks good, as it just passes the message from hook_privatemessage to workflow-ng. So I'm not sure if this are actually bugs of the integration or bugs of privatemsg 2.x? Shouldn't it pass the whole message object in case of deletion too? And shouldn't it use op 'prune' when deleting messages out of the trash?

I attach my exported testing rules, so you can use them to test too.

blucky’s picture

I'm new on patching. How to patch to my workflow_ng module with pm_workflow_ng_log_new.patch?
I'm confuse with many document or forum here explaining about patch windows or linux. Is it same patching windows and pacthing module?

Thanks.

Fayna’s picture

You're just patching the module, not your operating system (Windows, Linux, etc.). To patch a module is different on each OS, that is why they're mentioned. So depending on which OS you have determines how you will patch the module.

For patching a module in Windows: http://drupal.org/node/60179
For patching a module in Mac OS X: http://drupal.org/node/60818

blucky’s picture

Thanks Fayna. I was download patchsetup from http://gnuwin32.sourceforge.net/packages/patch.htm for windows and installed it. I already read the help and guide in it. Still confuse, how to pacth my module using command line patch in my Console(type 'cmd' on Run)?

Can I just copy coding on patch and paste it on my module? But I still want to learn to use patch.

solutiondrop’s picture

Title: workflow_ng integration » workflow_ng integration - characters in sent email

I've tested the patch and so far it looks good. The only big problem that I can tell is that the format of the sent email shows special HTML characters such as:

> That's

instead of

> That's

Has anyone else noticed this? When emails are sent from workflow_ng the characters are correctly displayed.

solutiondrop’s picture

Of course the special html characters were converted when I posted the last comment. Here they are again:

>

and single apostrophes come out as "& # 039;"

solutiondrop’s picture

Title: workflow_ng integration - characters in sent email » workflow_ng integration

Sorry, changed the Issue title on accident

marcor’s picture

Status: Needs review » Reviewed & tested by the community

Just tested the patch #11 on Drupal 5.x with the privatemsg 5.x-3.0-version, works fine! I did not check all available function, but main functionality (mail on sent pm) is no problem and the action is configurable. IMO this new module pm_workflow_ng can be included in the privatemsg-package.

litwol’s picture

Assigned: Unassigned » litwol

thank you for your contribution. i will review this.

Daryljames’s picture

what do I do with this? is this a module or a patch or both?

figured it out but couldn't get it to work right...

altparty’s picture

Is there already some progress on this?

litwol’s picture

Version: 5.x-2.x-dev » 5.x-3.x-dev
Assigned: litwol » Unassigned
Status: Reviewed & tested by the community » Closed (won't fix)

I apologize but support for d5 code have been discontinued. i took great care to provide clean and easy upgrade path from d5 versions to d6. currently only d6 and forward versions will receive *official* support. any volunteers are welcoem to continue offering support for d5 branch on the issue queue.