SOLVED: Form Email plugin on condition

dimoss

Well-Known Member
Hi,

I have setup successfuly the email form plugin to send emails only on edit when the status of the record change from 0 to 1 having following in condition:

PHP:
return '{fab_players___status_raw}' == 1;

The problem is that each time the same record is edited and obviously the condition is true the email plugin runs and sends the email to the recipient which is something i want to avoid.

I tried to "flag" the PK using a db trigger on After Update inserting the PK on a separate table and changing the query in the condition trying to exclude the email send when the PK is found on the other table but it seems the condition runs after the insertion of the PK is done and obviously it returns return false.

Any idea how to solve my problem?

Thanks.
 
Thanks Troester!
I did it using your advice as follows:

PHP:
$origData = $formModel->getOrigData();
$old = $origData[0]->fab_players___valid_raw;
$new = '{fab_players___valid_raw}';
if (($old != $new) && ($old == 0))
{return true;}
else
{return false;}
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top