Index: action_email_role.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/action_email_role/action_email_role.module,v retrieving revision 1.6 diff -u -p -r1.6 action_email_role.module --- action_email_role.module 13 Sep 2008 03:28:37 -0000 1.6 +++ action_email_role.module 5 Feb 2009 22:47:26 -0000 @@ -34,6 +34,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'] = 0; + } if (!isset($context['recipient'])) { $context['recipient'] = array(); } @@ -56,6 +59,14 @@ function action_email_role_send_email_ac $roles[$role->rid] = $role->name; } + $form['author_email'] = array( + '#type' => 'checkbox', + '#title' => t("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'), @@ -127,6 +138,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_state['values']['author_email'], 'recipient' => $form_state['values']['recipient'], 'subject' => $form_state['values']['subject'], 'message' => $form_state['values']['message'], @@ -140,8 +152,9 @@ 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; if ($context['node_types_set'] == 'all' || $context['node_types_selected'][$object->type]) { - $from = variable_get('site_mail', ini_get('sendmail_from')); + $from = ($context['author_email'] == 1) ? $user->mail : variable_get('site_mail', ini_get('sendmail_from')); $params['object'] = $object; $params['context'] = $context;