--- action_email_role.module.old 2008-06-08 00:05:09.000000000 +1000 +++ action_email_role.module 2008-06-08 03:03:50.000000000 +1000 @@ -35,6 +35,9 @@ function action_email_role_action_info() */ function action_email_role_send_email_action_form($context) { // Set default values for form. + if (!isset($context['author_email'])) { + $context['author_email'] = ''; + } if (!isset($context['recipient'])) { $context['recipient'] = ''; } @@ -52,6 +55,14 @@ function action_email_role_send_email_ac } // add form components + $form['author_email'] = array( + '#type' => 'checkbox', + '#title' => 'Show Author\'s email', + '#default_value' => $context['author_email'], + '#description' => t('Change the FROM field to the email of the user that caused the trigger. For example, the user that caused the workflow state change.'), + '#required' => FALSE, + ); + $form['recipient'] = array( '#type' => 'checkboxes', '#title' => t('Recipient Roles'), @@ -90,6 +101,7 @@ function action_email_role_send_email_ac // Process the HTML form to store configuration. The keyed array that // we return will be serialized to the database. $params = array( + 'author_email' => $form_values['author_email'], 'recipient' => $form_values['recipient'], 'subject' => $form_values['subject'], 'message' => $form_values['message'], @@ -102,9 +114,14 @@ function action_email_role_send_email_ac * Implementation of a configurable Drupal action. Sends an email to specified role(s). */ function action_email_role_send_email_action($object, $context) { + global $user; $node = $object; - $from = variable_get('site_mail', ini_get('sendmail_from')); + if($context['author_email'] == 0){ + $from = variable_get('site_mail', ini_get('sendmail_from')); + } else { + $from = $user->mail; + } $recipient = $context['recipient']; $subject = $context['subject']; $message = $context['message'];