it’s pretty simple really:
[!Load_WLPE_EventFunctions!]
[!WebLoginPE? &onLoginSuccess=`theFunctionName`!]
So, basically you create a snippet with your function declarations, and you call it prior to calling [!WebLoginPE!]
eForm also has a runSnippet parameter that allows you to "load" such functions in the same snippet call
e.g.
[!WebLoginPE? &customFunctions=`Load_WLPE_EventFunctions` &onLoginSuccess=`theFunctionName`!]
Then, (as with eForm), it simply runs the function reference at the appropriate event/time.
eForm example for running an event function (slightly modified):
//<?php
# invoke onBeforeFormParse event set by another script
if ($eFormOnBeforeFormParse) {
if( $isDebug && !function_exists($eFormOnBeforeFormParse))
$fields['debug'] .= "eFormOnBeforeFormParse event: Could not find the function " . $eFormOnBeforeFormParse;
else{
$templates = array('tpl'=>$tpl,'report'=>$report,'thankyou'=>$thankyou,'autotext'=>$autotext);
if( $eFormOnBeforeFormParse($fields,$templates)===false )
return ""; // Error
else{
// Success
}
}
}
Note how eForm actually passes certain variables as arguments to the custom functions. This way, the custom functions can interact with and have more control over the eForm variables.
If you take your function arguments "by reference", you can even manipulate the data for use by WLPE prior to returning to WLPE’s process.
//<?php
function theFunctionName( &$arg1, &$arg2 ){
//...
}