Download & Extend

Add token to requirements or fix fieldactions_general_mail

Project:Field Actions
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:major
Assigned:Unassigned
Status:needs work

Issue Summary

I've spent 1 hour trying to find out why I get empty subject and email from fieldactions.
It turned out that token module was missing, but fieldactions rely on it when defining subject and body:

<?php
function fieldactions_general_mail($key, &$message, $params) {
 
// replace the subjects and messages with their token replaced equivalents
 
if (module_exists('token')) {
   
$subject = token_replace($params['context']['subject'], 'node', $params['node']);
   
$body = token_replace($params['context']['message'], 'node', $params['node']);
  }
 
$subject = strtr($subject, $params['vars']);
 
$message['subject'] = str_replace(array("\r", "\n"), '', $subject);
 
$message['body'][] = strtr($body, $params['vars']);
}
?>

$subject and $body will be empty when sending email, if token module disabled. I guess the best idea here is to add else section to the code and initialize subject and body there.

nobody click here