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

Contents of /contributions/modules/fieldactions/fieldactions.module

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


Revision 1.8 - (show annotations) (download) (as text)
Wed Aug 12 15:02:16 2009 UTC (3 months, 2 weeks ago) by deekayen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +87 -16 lines
File MIME type: text/x-php
sync with DRUPAL-6--1
#547062 by jajathejazzcat: update remnant from Drupal 5 to make correct debug message in sending email action
add some watchdog severity levels to other watchdog calls
1 <?php
2 // $Id: fieldactions.module,v 1.7 2008/12/23 05:04:34 deekayen Exp $
3
4 /**
5 * @file
6 * Actions-based things to do with CCK fields.
7 */
8
9 /**
10 * Implementation of hook_action_info().
11 */
12 function fieldactions_action_info() {
13 return array(
14 'fieldactions_assign_owner_to_userreference_action' => array(
15 'description' => t('Change node author based on a user reference field'),
16 'configurable' => TRUE,
17 'type' => 'node',
18 'hooks' => array(
19 'nodeapi' => array('insert', 'update')
20 )
21 ),
22 'fieldactions_assign_value_to_nodereference_action' => array(
23 'description' => t('Change node reference value'),
24 'configurable' => TRUE,
25 'type' => 'node',
26 'hooks' => array(
27 'nodeapi' => array('insert', 'update')
28 )
29 ),
30 'fieldactions_send_email_to_userreference_action' => array(
31 'description' => t('Send email to a user reference field'),
32 'type' => 'node',
33 'configurable' => TRUE,
34 'hooks' => array(
35 'nodeapi' => array('insert', 'update')
36 )
37 ),
38 'fieldactions_send_email_to_nodereference_action' => array(
39 'description' => t('Send email to the author of the node selected in the node reference field'),
40 'type' => 'node',
41 'configurable' => TRUE,
42 'hooks' => array(
43 'nodeapi' => array('insert', 'update')
44 )
45 ),
46 'fieldactions_send_email_to_owner_action' => array(
47 'description' => t('Send email to the creator of the node'),
48 'type' => 'node',
49 'configurable' => TRUE,
50 'hooks' => array(
51 'nodeapi' => array('insert', 'update')
52 )
53 ),
54 'fieldactions_send_email_to_email_action' => array(
55 'description' => t('Send email to the value of an email widget field'),
56 'type' => 'node',
57 'configurable' => TRUE,
58 'hooks' => array(
59 'nodeapi' => array('insert', 'update')
60 )
61 )
62 );
63 }
64
65 /**
66 * General handler for replacing tokens and setting the subject and body for outgoing email.
67 * Expects context, node, and vars elements in the $params parameter.
68 */
69 function fieldactions_general_mail($key, &$message, $params) {
70 // replace the subjects and messages with their token replaced equivalents
71 if (module_exists('token')) {
72 $subject = token_replace($params['context']['subject'], 'node', $params['node']);
73 $body = token_replace($params['context']['message'], 'node', $params['node']);
74 }
75 $subject = strtr($subject, $params['vars']);
76 $message['subject'] = str_replace(array("\r", "\n"), '', $subject);
77 $message['body'][] = strtr($body, $params['vars']);
78 }
79
80 /**
81 * Implementation of an action.
82 * Assigns the ownership of a node to a value in a User Reference field.
83 */
84 function fieldactions_assign_owner_to_userreference_action($node, $context) {
85 if (isset($node->{$context['ur_field_name']}[0])) {
86 $uid = $node->{$context['ur_field_name']}[0]['uid'];
87 $node->uid = $uid;
88 $node->revision = '0';
89 if (!$context['defer']) {
90 node_save($node);
91 }
92 watchdog('fieldactions', 'Changed owner of node %id to uid %uid', array('%id' => intval($node->nid), '%uid' => intval($uid)), WATCHDOG_INFO);
93 }
94 else {
95 watchdog('fieldactions', 'Could not reassign the owner of node %id because it did not contain the specified user reference field', array('%id' => intval($node->nid)), WATCHDOG_WARNING);
96 }
97 }
98
99 /**
100 * Form array for configuring the advanced action to edit the action that
101 * switches the node author to the value of a userreference field.
102 *
103 * @return array
104 */
105 function fieldactions_assign_owner_to_userreference_action_form($context) {
106 $form = array();
107 $form['ur_field_name'] = array(
108 '#type' => 'select',
109 '#title' => t('User Reference Field'),
110 '#default_value' => $context['ur_field_name'],
111 '#options' => _fieldactions_userreference_fields(),
112 '#description' => t('Select the user reference field to use when reassigning node ownership. If this field does not exist in the node when the action runs, ownership will not change. If there are more than one users in the field, this action will select the first user.')
113 );
114 return $form;
115 }
116
117 /**
118 * Implementation of a Drupal action.
119 * Assigns ownership of a node to a user defined in a user reference field.
120 * If multiple users are defined, only the user will become the owner.
121 */
122 function fieldactions_assign_owner_to_userreference_action_submit($form, &$form_state) {
123 return array('ur_field_name' => $form_state['values']['ur_field_name']);
124 }
125
126 /**
127 * Implementation of an action.
128 * Assigns a value to a node reference field.
129 */
130 function fieldactions_assign_value_to_nodereference_action($node, $context) {
131 if (isset($node->{$context['nr_field_name']}[0])) {
132 $node->{$context['nr_field_name']}[0]['nid'] = $context['nr_field_value'];
133 $node->revision = '0';
134 if (!$context['defer']) {
135 node_save($node);
136 }
137 watchdog('fieldactions', 'Changed value of node reference field %field in node %id to reference %nid.', array('%field' => $context['nr_field_name'], '%id' => intval($node->nid), '%nid' => intval($context['nr_field_value'])), WATCHDOG_INFO);
138 }
139 else {
140 watchdog('fieldactions', 'Could not reset the value of node reference %field in node %id to %nid because it did not contain the specified node reference field.', array('%field' => $context['nr_field_name'], '%id' => intval($node->nid), '%nid' => intval($context['nr_field_value'])), WATCHDOG_NOTICE);
141 }
142 }
143
144 /**
145 * Form array for configuring the advanced action to edit the action that
146 * switches the node reference to a configured value.
147 *
148 * @return array
149 */
150 function fieldactions_assign_value_to_nodereference_action_form($context) {
151 $form = array();
152 $form['nr_field_name'] = array(
153 '#type' => 'select',
154 '#title' => t('Node reference field'),
155 '#default_value' => $context['nr_field_name'],
156 '#options' => _fieldactions_nodereference_fields(),
157 '#description' => t('Select the user reference field to use when reassigning node ownership. If this field does not exist in the node when the action runs, ownership will not change. If there are more than one users in the field, this action will select the first user.')
158 );
159 $form['nr_field_value'] = array(
160 '#type' => 'textfield',
161 '#title' => t('Node reference value'),
162 '#size' => 10,
163 '#required' => TRUE,
164 '#default_value' => $context['nr_field_value'],
165 '#description' => t('Enter a numeric value of a node id to set the node reference field when the action is fired.')
166 );
167 return $form;
168 }
169
170 function fieldactions_assign_value_to_nodereference_action_validate($form, &$form_state) {
171 if ($form_state['values']['nr_field_value'] == '' || !is_numeric($form_state['values']['nr_field_value'])) {
172 form_set_error('nr_field_value', t('The node reference value must be numeric.'));
173 }
174 if (!node_load($form_state['values']['nr_field_value'])) {
175 form_set_error('nr_field_value', t('Specified node does not exist.'));
176 }
177 }
178
179 /**
180 * Implementation of a Drupal action.
181 * Assigns ownership of a node to a user defined in a user reference field.
182 * If multiple users are defined, only the user will become the owner.
183 */
184 function fieldactions_assign_value_to_nodereference_action_submit($form, &$form_state) {
185 return array(
186 'nr_field_name' => $form_state['values']['nr_field_name'],
187 'nr_field_value' => $form_state['values']['nr_field_value']
188 );
189 }
190
191 /**
192 * Implementation of a Drupal action.
193 * This action sends email to each user in a user reference field.
194 * If the field is empty, no email will be sent.
195 * Multiple fields send multiple emails.
196 *
197 * By switching the type to user in fieldactions_action_info(), the first
198 * parameter will already be the user object so this function wouldn't have
199 * to do the user_load() inside it. The reason that wasn't done here is
200 * because the tokens for this action are based on the node. $context will
201 * have the node information even if this action type was user.
202 */
203 function fieldactions_send_email_to_userreference_action($node, $context) {
204 // does this node have the recipient user ref field?
205 if (isset($node->{$context['recipient']}) && is_array($node->{$context['recipient']})) {
206 // pull out each represenation of the field (an array with 'uid) in it
207 foreach ($node->{$context['recipient']} as $field) {
208 // empty fields have the uid key set, but aren't valid
209 // also, we can't send mail to anonymous users, so don't try
210 if (empty($field['uid'])) {
211 continue;
212 }
213
214 // load the user we want
215 $ref_user = user_load(array('uid' => $field['uid']));
216
217 // create the varibales array from this user and the node
218 $vars = _fieldactions_userreference_token_replacements($ref_user, $node);
219
220 $from = $vars['%site_name'] .' <'. $vars['%site_mail'] .'>';
221
222 $account = user_load($vars['%user_ref_mail']);
223 $language = user_preferred_language($account);
224
225 $params = array(
226 'context' => $context,
227 'node' => $node,
228 'vars' => $vars
229 );
230 if (drupal_mail('fieldactions_general', 'fieldactions_userreference', $vars['%user_ref_mail'], $language, $params, $from, TRUE)) {
231 watchdog('fieldactions', 'Sent email to %recipient', array('%recipient' => $vars['%user_ref_mail']), WATCHDOG_INFO);
232 }
233 else {
234 watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $recipient), WATCHDOG_WARNING);
235 }
236 }
237 }
238 }
239
240 function fieldactions_send_email_to_userreference_action_form($context) {
241 if (!isset($context['subject'])) $context['subject'] = '';
242 if (!isset($context['message'])) $context['message'] = '';
243
244 $form = array();
245
246 $form['recipient'] = array(
247 '#type' => 'select',
248 '#title' => t('Recipient User Reference Field'),
249 '#default_value' => $context['recipient'],
250 '#options' => _fieldactions_userreference_fields(),
251 '#description' => t('Select the user reference field to use as the recipient of this email message. If this field does not exist in the node when the action runs, email will not be sent. If there are more than one users in the field, this action will select the first user.')
252 );
253 $form['subject'] = array(
254 '#type' => 'textfield',
255 '#title' => t('Subject'),
256 '#default_value' => $context['subject'],
257 '#size' => '20',
258 '#maxlength' => '254',
259 '#description' => t('The subject of the message.')
260 );
261 $form['message'] = array(
262 '#type' => 'textarea',
263 '#title' => t('Message'),
264 '#default_value' => $context['message'],
265 '#cols' => '80',
266 '#rows' => '20',
267 '#description' => t('The message that should be sent. You may include the following variables:') .' '. implode(', ', array_keys(_fieldactions_userreference_token_replacements()))
268 );
269 if (module_exists('token')) {
270 $form['token_help'] = array(
271 '#title' => t('Replacement patterns'),
272 '#type' => 'fieldset',
273 '#collapsible' => TRUE,
274 '#collapsed' => TRUE,
275 '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!')
276 );
277 $form['token_help']['help'] = array(
278 '#value' => theme('token_help', 'node')
279 );
280 }
281 return $form;
282 }
283
284 function fieldactions_send_email_to_userreference_action_submit($form, &$form_state) {
285 return array(
286 'recipient' => $form_state['values']['recipient'],
287 'subject' => $form_state['values']['subject'],
288 'message' => $form_state['values']['message']
289 );
290 }
291
292 function fieldactions_send_email_to_nodereference_action($node, $context) {
293 // does this node have the node reference field?
294 if (isset($node->{$context['node']}) && is_array($node->{$context['node']})) {
295 // pull out each represenation of the field (an array with nid) in it
296 foreach ($node->{$context['node']} as $field) {
297 //a nonexistant nid field means that the nodereference box was not used
298 if (!isset($field['nid'])) {
299 continue;
300 }
301
302 // load the node referenced in the field
303 $referred_node = node_load($field['nid']);
304
305 // create the variables array from this node and the referred node
306 $vars = _fieldactions_nodereference_token_replacements($referred_node, $node);
307
308 // construct the actual message
309 $from = $vars['%site_name'] .' <'. $vars['%site_mail'] .'>';
310
311 $account = user_load($vars['%referred_node_owner_mail']);
312 $language = user_preferred_language($account);
313
314 $params = array(
315 'context' => $context,
316 'node' => $node,
317 'vars' => $vars
318 );
319
320 // mail it and log it
321 if (drupal_mail('fieldactions_general', 'fieldactions_nodereference', $vars['%referred_node_owner_mail'], $language, $params, $from, TRUE)) {
322 watchdog('fieldactions', 'Sent email to %recipient', array('%recipient' => $vars['%referred_node_owner_mail']), WATCHDOG_INFO);
323 }
324 else {
325 watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $vars['%referred_node_owner_mail']), WATCHDOG_WARNING);
326 }
327 }
328 }
329 }
330
331 function fieldactions_send_email_to_nodereference_action_form($context) {
332 if (!isset($context['subject'])) $context['subject'] = '';
333 if (!isset($context['message'])) $context['message'] = '';
334
335 $form = array();
336
337 $form['node'] = array(
338 '#type' => 'select',
339 '#title' => t('Recipient Node Reference Field'),
340 '#default_value' => $context['node'],
341 '#options' => _fieldactions_nodereference_fields(),
342 '#description' => t("Select the node reference field that will reference the node(s) who's author(s) will recieve this email. If this field does not exist in the node when the action runs, email will not be sent."),
343 );
344 $form['subject'] = array(
345 '#type' => 'textfield',
346 '#title' => t('Subject'),
347 '#default_value' => $context['subject'],
348 '#size' => '20',
349 '#maxlength' => '254',
350 '#description' => t('The subject of the message.')
351 );
352 $form['message'] = array(
353 '#type' => 'textarea',
354 '#title' => t('Message'),
355 '#default_value' => $context['message'],
356 '#cols' => '80',
357 '#rows' => '20',
358 '#description' => t('The message that should be sent. You may include the following variables:') .' '. implode(', ', array_keys(_fieldactions_nodereference_token_replacements()))
359 );
360 if (module_exists('token')) {
361 $form['token_help'] = array(
362 '#title' => t('Replacement patterns'),
363 '#type' => 'fieldset',
364 '#collapsible' => TRUE,
365 '#collapsed' => TRUE,
366 '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!')
367 );
368 $form['token_help']['help'] = array(
369 '#value' => theme('token_help', 'node')
370 );
371 }
372 return $form;
373 }
374
375 function fieldactions_send_email_to_nodereference_action_submit($form, &$form_state) {
376 return array(
377 'node' => $form_state['values']['node'],
378 'subject' => $form_state['values']['subject'],
379 'message' => $form_state['values']['message']
380 );
381 }
382
383 function fieldactions_send_email_to_owner_action($node, $context) {
384 // load the user we want
385 $user = user_load(array('uid' => $node->uid));
386
387 // create the variables array from this user and the node
388 $vars = _fieldactions_userreference_token_replacements($user, $node);
389
390 // construct the actual message
391 $from = $vars['%site_name'] .' <'. $vars['%site_mail'] .'>';
392 $language = user_preferred_language($user);
393
394 $params = array(
395 'node' => $node,
396 'context' => $context,
397 'vars' => $vars
398 );
399
400 if (drupal_mail('fieldactions_general', 'fieldactions_mail_to_owner', $vars['%node_owner_mail'], $language, $params, $from, TRUE)) {
401 watchdog('fieldactions', 'Sent email to %recipient', array('%recipient' => $vars['%node_owner_mail']), WATCHDOG_INFO);
402 }
403 else {
404 watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $vars['%node_owner_mail']), WATCHDOG_WARNING);
405 }
406 }
407
408 function fieldactions_send_email_to_owner_action_form($context) {
409 if (!isset($context['subject'])) $context['subject'] = '';
410 if (!isset($context['message'])) $context['message'] = '';
411
412 $form = array();
413
414 $form['subject'] = array(
415 '#type' => 'textfield',
416 '#title' => t('Subject'),
417 '#default_value' => $context['subject'],
418 '#size' => '20',
419 '#maxlength' => '254',
420 '#description' => t('The subject of the message.')
421 );
422 $form['message'] = array(
423 '#type' => 'textarea',
424 '#title' => t('Message'),
425 '#default_value' => $context['message'],
426 '#cols' => '80',
427 '#rows' => '20',
428 '#description' => t('The message that should be sent. You may include the following variables:') .' '. implode(', ', array_keys(_fieldactions_userreference_token_replacements()))
429 );
430 if (module_exists('token')) {
431 $form['token_help'] = array(
432 '#title' => t('Replacement patterns'),
433 '#type' => 'fieldset',
434 '#collapsible' => TRUE,
435 '#collapsed' => TRUE,
436 '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!')
437 );
438 $form['token_help']['help'] = array(
439 '#value' => theme('token_help', 'node')
440 );
441 }
442 return $form;
443 }
444
445 function fieldactions_send_email_to_owner_action_submit($form, &$form_state) {
446 return array(
447 'subject' => $form_state['values']['subject'],
448 'message' => $form_state['values']['message']
449 );
450 }
451
452 function fieldactions_send_email_to_email_action_form($context) {
453 if (!isset($context['subject'])) $context['subject'] = '';
454 if (!isset($context['message'])) $context['message'] = '';
455
456 $form = array();
457
458 $form['field'] = array(
459 '#type' => 'select',
460 '#title' => t('Recipient Email Field'),
461 '#default_value' => $context['field'],
462 '#options' => _fieldactions_email_fields(),
463 '#description' => t("Select the email field that will receive this email. If this field does not exist in the node when the action runs, email will not be sent."),
464 );
465 $form['subject'] = array(
466 '#type' => 'textfield',
467 '#title' => t('Subject'),
468 '#default_value' => $context['subject'],
469 '#size' => '20',
470 '#maxlength' => '254',
471 '#description' => t('The subject of the message.')
472 );
473 $form['message'] = array(
474 '#type' => 'textarea',
475 '#title' => t('Message'),
476 '#default_value' => $context['message'],
477 '#cols' => '80',
478 '#rows' => '20',
479 '#description' => t('The message that should be sent. You may include the following variables:') .' '. implode(', ', array_keys(_fieldactions_email_token_replacements()))
480 );
481 if (module_exists('token')) {
482 $form['token_help'] = array(
483 '#title' => t('Replacement patterns'),
484 '#type' => 'fieldset',
485 '#collapsible' => TRUE,
486 '#collapsed' => TRUE,
487 '#description' => t('Prefer raw-text replacements for text to avoid problems with HTML entities!')
488 );
489 $form['token_help']['help'] = array(
490 '#value' => theme('token_help', 'node')
491 );
492 }
493 return $form;
494 }
495
496 function fieldactions_send_email_to_email_action_submit($form, &$form_state) {
497 return array(
498 'field' => $form_state['values']['field'],
499 'subject' => $form_state['values']['subject'],
500 'message' => $form_state['values']['message']
501 );
502 }
503
504 function fieldactions_send_email_to_email_action($node, $context) {
505 // load the user we want
506 if (!empty($context['field']) && !empty($node->{$context['field']}[0]['email'])) {
507 foreach ($node->$context['field'] as $field_value) {
508 $user = user_load(array('mail' => $field_value['email']));
509
510 // create the variables array from this user and the node
511 $vars = _fieldactions_email_token_replacements($user, $node);
512
513 // construct the actual message
514 $from = $vars['%site_name'] .' <'. $vars['%site_mail'] .'>';
515 $language = $user != FALSE ? user_preferred_language($user) : language_default();
516
517 $params = array(
518 'node' => $node,
519 'context' => $context,
520 'vars' => $vars
521 );
522
523 if (drupal_mail('fieldactions_general', 'fieldactions_mail_to_email', $field_value['email'], $language, $params, $from, TRUE)) {
524 watchdog('fieldactions', 'Sent email to %recipient', array('%recipient' => $field_value['email']), WATCHDOG_INFO);
525 }
526 else {
527 watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $field_value['email']), WATCHDOG_WARNING);
528 }
529 }
530 }
531 }
532
533 /**
534 * Get a list of all the email fields.
535 */
536 function _fieldactions_email_fields() {
537 $allfields = content_fields();
538 $fields = array();
539 foreach ($allfields as $name => $field) {
540 if ($field['type'] == 'email') {
541 // if a field is used twice, we only need one label, but we append
542 // the field name to remove ambiguity about where this will apply
543 $fields[$name] = $field['widget']['label'] ." ($name)";
544 }
545 }
546
547 return $fields;
548 }
549
550 /**
551 * Get a list of all the node reference fields.
552 */
553 function _fieldactions_nodereference_fields() {
554 $allfields = content_fields();
555 $fields = array();
556 foreach ($allfields as $name => $field) {
557 if ($field['type'] == 'nodereference') {
558 // if a field is used twice, we only need one label, but we append
559 // the field name to remove ambiguity about where this will apply
560 $fields[$name] = $field['widget']['label'] ." ($name)";
561 }
562 }
563
564 return $fields;
565 }
566
567 /**
568 * Get a list of all the user reference fields.
569 */
570 function _fieldactions_userreference_fields() {
571 $allfields = content_fields();
572 $fields = array();
573 foreach ($allfields as $name => $field) {
574 if ($field['type'] == 'userreference') {
575 // if a field is used twice, we only need one label, but we append
576 // the field name to remove ambiguity about where this will apply
577 $fields[$name] = $field['widget']['label'] ." ($name)";
578 }
579 }
580
581 return $fields;
582 }
583
584 function _fieldactions_email_token_replacements($subject = NULL, $node = NULL) {
585 global $user;
586 $node_owner = user_load(array('uid' => $node->uid));
587
588 $variables = array(
589 '%site_name' => variable_get('site_name', 'Drupal'),
590 '%site_mail' => variable_get('site_mail', ini_get('sendmail_from')),
591 '%node_owner_name' => $node_owner->name,
592 '%node_owner_mail' => $node_owner->mail,
593 '%node_owner_uid' => $node_owner->uid,
594 '%current_user_name' => $user->name,
595 '%current_user_mail' => $user->mail,
596 '%current_user_uid' => $user->uid,
597 '%node_url' => url('node/'. $node->nid, array('absolute' => TRUE)),
598 '%site_url' => url('', array('absolute' => TRUE)),
599 '%node_type' => $node->type,
600 '%title' => $node->title,
601 '%teaser' => strip_tags($node->teaser),
602 '%body' => strip_tags($node->body)
603 );
604
605 return $variables;
606 }
607
608 function _fieldactions_userreference_token_replacements($subject = NULL, $node = NULL) {
609 global $user;
610 $node_owner = user_load(array('uid' => $node->uid));
611
612 $variables = array(
613 '%site_name' => variable_get('site_name', 'Drupal'),
614 '%site_mail' => variable_get('site_mail', ini_get('sendmail_from')),
615 '%user_ref_name' => $subject->name,
616 '%user_ref_mail' => $subject->mail,
617 '%user_ref_uid' => $subject->uid,
618 '%node_owner_name' => $node_owner->name,
619 '%node_owner_mail' => $node_owner->mail,
620 '%node_owner_uid' => $node_owner->uid,
621 '%current_user_name' => $user->name,
622 '%current_user_mail' => $user->mail,
623 '%current_user_uid' => $user->uid,
624 '%node_url' => url('node/'. $node->nid, array('absolute' => TRUE)),
625 '%site_url' => url('', array('absolute' => TRUE)),
626 '%node_type' => $node->type,
627 '%title' => $node->title,
628 '%teaser' => strip_tags($node->teaser),
629 '%body' => strip_tags($node->body)
630 );
631
632 return $variables;
633 }
634
635 function _fieldactions_nodereference_token_replacements($referred_node = NULL, $referring_node = NULL) {
636 global $user; //creator of referring node
637 $referred_node_owner = user_load(array('uid' => $referred_node->uid)); //creator of referred node
638
639 $variables = array(
640 '%site_name' => variable_get('site_name', 'Drupal'),
641 '%site_mail' => variable_get('site_mail', ini_get('sendmail_from')),
642 '%referred_node_owner_name' => $referred_node_owner->name,
643 '%referred_node_owner_mail' => $referred_node_owner->mail,
644 '%referred_node_owner_uid' => $referred_node_owner->uid,
645 '%referring_node_owner_name' => $user->name,
646 '%referring_node_owner_mail' => $user->mail,
647 '%referring_node_owner_uid' => $user->uid,
648 '%referred_node_url' => url('node/'. $referred_node->nid, array('absolute' => TRUE)),
649 '%referring_node_url' => url('node/'. $referring_node->nid, array('absolute' => TRUE)),
650 '%site_url' => url('', array('absolute' => TRUE)),
651 '%referred_node_type' => $referred_node->type,
652 '%referring_node_type' => $referring_node->type,
653 '%referred_node_title' => $referred_node->title,
654 '%referring_node_title' => $referring_node->title,
655 '%referred_node_teaser' => strip_tags($referred_node->teaser),
656 '%referring_node_teaser' => strip_tags($referring_node->teaser),
657 '%referred_node_body' => strip_tags($referred_node->body),
658 '%referring_node_body' => strip_tags($referring_node->body)
659 );
660
661 return $variables;
662 }

  ViewVC Help
Powered by ViewVC 1.1.2