Some element placeholders not being evaluated on list col update plugin

Guys,

I am using list col update plugin and its working well except for one issue. When I put php code and include element placeholders in the email message body and select "eval" some element place holders are not being evaluated and I get the message "Message body empty" instead of the email body.

I am using this simple code to test:

$invoice_approved ={invoice_central___invoice_approved};
return $invoice_approved;

So this particular code does not send the email but returns an error message "Message body empty". There are a few elements in my list where this code is working but others don't.

Whats even more weird is that this element place holder works perfect if I don't use php and "eval" i.e. just type {invoice_central___invoice_approved} in the email message field

Long story short. All element placeholders are working well when I don't use eval and some work and some fail when I use eval.

Has anyone come across this?

Regards
Simon
 
In php code you must quote placeholders
$invoice_approved ='{invoice_central___invoice_approved}';

If you need e.g. an integer value do additionaly type casting
$invoice_approved =(int)'{invoice_central___invoice_approved}';
 
Remember that placeholders aren't a part of PHP itself. Fabrik substitutes the values for the placehoders in your code before we pass the code to PHP to evaluate. So if you don't put quotes around placeholders, you can end up generating invalid PHP, like ...

Code:
$invoice_approved = Yes;

... which will throw a syntax error ("unexpected T_WORD"). You need those quotes around the placeholder so the resulting PHP is ...

Code:
$invoice_approved ='Yes';

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top