/[drupal]/contributions/modules/actions/actions.module
ViewVC logotype

Diff of /contributions/modules/actions/actions.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.33, Thu Apr 10 14:12:57 2008 UTC revision 1.34, Thu Apr 17 18:40:47 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: actions.module,v 1.32 2008/04/09 18:19:25 jvandyk Exp $  // $Id: actions.module,v 1.33 2008/04/10 14:12:57 jvandyk Exp $
3    
4  /**  /**
5   * @file   * @file
# Line 1087  function system_send_email_action_form($ Line 1087  function system_send_email_action_form($
1087      '#default_value' => $context['message'],      '#default_value' => $context['message'],
1088      '#cols' => '80',      '#cols' => '80',
1089      '#rows' => '20',      '#rows' => '20',
1090      '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'),      '#description' => t('The message that should be sent. You may include the following variables: %site_name, %username, %uid, %node_url, %node_type, %title, %teaser, %body. Not all variables will be available in all contexts.'),
1091    );    );
1092    return $form;    return $form;
1093  }  }
# Line 1167  function system_send_email_action($objec Line 1167  function system_send_email_action($objec
1167    
1168    if (!isset($account)) {    if (!isset($account)) {
1169      $account = $user;      $account = $user;
   
1170    }    }
1171    
1172    $subject = $context['subject'];    $subject = $context['subject'];
1173    $message = $context['message'];    $message = $context['message'];
1174    $from = variable_get('site_mail', ini_get('sendmail_from'));    $from = variable_get('site_mail', ini_get('sendmail_from'));
1175    
1176      $variables = array(
1177        '%site_name' => variable_get('site_name', 'Drupal'),
1178        '%username' => $account->name,
1179      );
1180      if ($context['hook'] == 'taxonomy') {
1181        $vocabulary = taxonomy_vocabulary_load($object->vid);
1182        $variables += array(
1183          '%term_name' => $object->name,
1184          '%term_description' => $object->description,
1185          '%term_id' => $object->tid,
1186          '%vocabulary_name' => $vocabulary->name,
1187          '%vocabulary_description' => $vocabulary->description,
1188          '%vocabulary_id' => $vocabulary->vid,
1189        );
1190      }
1191    
1192      // Node-based variable translation is only available if we have a node.
1193      if (isset($node)) {
1194        $variables += array(
1195          '%uid' => $node->uid,
1196          '%node_url' => url('node/'. $node->nid, NULL, NULL, TRUE),
1197          '%node_type' => node_get_types('name', $node),
1198          '%title' => $node->title,
1199          '%teaser' => $node->teaser,
1200          '%body' => $node->body,
1201        );
1202      }
1203      $subject = strtr($context['subject'], $variables);
1204      $subject = str_replace(array("\r", "\n"), '', $subject);
1205      $message = strtr($context['message'], $variables);
1206    
1207    if (drupal_mail('action_send_email', $recipient, $subject, $message, $from)) {    if (drupal_mail('action_send_email', $recipient, $subject, $message, $from)) {
1208      watchdog('action', t('Sent email to %recipient', array('%recipient' => $recipient)));      watchdog('action', t('Sent email to %recipient', array('%recipient' => $recipient)));
1209    }    }

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

  ViewVC Help
Powered by ViewVC 1.1.2