This question has been answered by charless. See the first response.
$fieldVals = $hook->getProperties();
$emailOwners = explode(',',$fieldVals['emailOwners']);
$emailOwners[]='[email protected]';
$hook->setProperties('emailOwners',implode(',',$emailOwners));
//get the emailOwners property and explode it into an array. Is there ever a value in this for a hook?
$emailOwners = explode(',',$hook->getProperty('emailOwners'));
//Add addresses
$emailOwners[]='[email protected]';
$emailOwners[]='[email protected]';
//set the property of the hook to the new string by exploding the array
$hook->setProperty('emailOwners',implode(',',$emailOwners));
//tell mxfb that this script has run
return true;
To break this out, since it conflicts whats in the online documentation:
a PreHook fires BEFORE the form is rendered and AFTER the submit action is registered but BEFORE mxfb processes the submission
and a Hook fires AFTER a successful submission/email happens from mxfb
The rtfm on this has the prehook happening prior to form rendering and it looks like it does both from my error logs. I
The preHook does work to add the new email addresses to email owners, though.