First of all, I think this is a great module and very customizible.
Is there any possibility to allow this module to send autmatic email to node author whenever somebody click/flag its content?
Or how can I and where modify this module to achive this function.

CommentFileSizeAuthor
#5 flag_repeat_action.patch9.38 KBquicksketch

Comments

quicksketch’s picture

Category: task » support

You can enable the Flag Actions module, then set up an action to send an e-mail from the admin/build/flags/actions tab. Use "%author" as the recipient if using a normal e-mail. If you're using the Token Actions module (which I'd recommend) then you can use "[author-mail-raw]" if using a tokenized e-mail.

neddim’s picture

I am aware of this possibility.
But, I would like to have option for sending email whenever somebody positivly rate/flag content.

quicksketch’s picture

Title: Send an email to author whenever somebody Flag content? » Add ability to "repeat" actions after threshold
Category: support » feature

Ah... I'm not sure if there's a request for that specific functionality so let's make this issue it. I've long thought that the ability to "repeat" an action is necessary. To make this possible, I think the most reasonable UI would be something like this:

Perform action when content [reaches] [10] flags
[ x ] Repeat this action every [5] additional flags after the threshold is reached

So in your case you would set the threshold to 1 and the repeat action to 1, essentially making the action fire every flag. How does that solution sound?

neddim’s picture

This solution sounds perfect if can be done :)
How to achive repet action?

quicksketch’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Fixed
StatusFileSize
new9.38 KB

I've added this to the 2.x version with the attached patch. This is something we've needed for a long time. Please create a new issue for any problems with this change. If you're not comfortable with checking out the 2.x version from CVS, you can download the nightly archive at http://drupal.org/node/576390. Note you may need to wait a day before this archive is updated with the latest changes.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

plan9’s picture

I can't find this repeat option in 5.x

Is it possible to achieve somehow in 5.x? I really need this function.

Thanks

G

mooffie’s picture

@plan9,

In some other thread you asked for a D5 hack. Well, in 'flag_actions.module' you'll find the following line...

(($action->event == 'flag'   && $count == $action->threshold) ||

...change it to:

(($action->event == 'flag'   && $count >= $action->threshold) ||

I believe this will make all the actions fire "repeatedly" (which, I think, is what usually expected).

(You should keep a document explaining all the modifications you made to Drupal/contrib source code, and consult it after upgrading the site.)

===

A different approach is to implement hook_flag() and write your own PHP code to send the mail:

function MYMODULE_flag($action, $flag, $content_id, $account) {
  if ($action == 'flag' && $flag->name == 'bookmarks') {
    drupal_set_message("I'm sending email!!111"); // Just for debugging.
    $node = node_load($content_id);
    $author = user_load($node->uid);
    drupal_mail('flag_notify', $author->mail, $account->name . ' has just flagged your ' . $node->title, "you're da man!");
  }
}

(I probably have typos here.)

plan9’s picture

I used your first example and it works perfectly. It's good also to have the second option as something to build upon if necessary.
Thanks so much for taking the time to post these solutions - it's very much appreciated.

:)