Multiple conditional email plugins on a form

I have a form where I want to have two different conditional email plug-ins. I followed code found in this forums and used it for the first conditional plug-in with no problems. The code is:
Code:
$origData = $formModel->getOrigData();
$origData = FArrayHelper::getValue($origData, 0, new stdClass);
$origValue = FArrayHelper::getValue($origData, '{members___welcome}', false);
$origValue = new DateTime($origValue);
$origValue = $origValue->format('Y/m/d');
$newValue ='{members___welcome}';
if ($origValue === $newValue) {
   return false;
}
return true;

The code works exactly as I want. When the date field, members___welcome is updated on a record being edited, it triggers an email send. However, I also need to use similar conditional code to send a different email, based on a change to a different date field. When I add the 2nd email plug-in, I'm getting odd behavior. The first plug-in seems to get fired even when only the conditions for the 2nd one are met. The second one never fires under any conditions, even if the first one is unpublished.

I've tried changing the variables in the second plug in, in case perhaps they were colliding with the first plug-in, but it hasn't helped.

Can I use multiple, conditional email plug-ins in a form? If not, is there a way to use a value set in the conditional code to modify the content of the email? Perhaps I need to change this to a single PHP plug-in that generates mail? If so, can I use an article template in the php?
 
FWIW: I found that even when the 2nd email plug-in was unpublished, it caused problems with the published one. Until deleted, the 2nd one, while unpublished, was causing the first one to fire on every save of the form, regardless of whether or not the conditions of the first plug-in were met. Weird but true!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top