Thread Starter
e dev
(@efishinsea)
So, just an update, but still in need of a solution, I have created a callback to catch the error from response, and I am now getting an email sent to me from this error,
**RAW RESPONSE**
Array
(
[reason] => Service Callback Failure
[safe_message] => Service Callback Failure
[errors] => Array
(
[0] => Account or Email address already exists. Please try again.
)
)
but the error is never shown to the user, and the form submits as if everything is ok.
Here is what I am using currently:
if(!class_exists('Cf73rdParty_ExistingCallbacks')):
// Encapsulate any and all 3rd-party service callback functions
class Cf73rdParty_ExistingCallbacks {
public function __construct(){
add_action('Forms3rdPartyIntegration_service_a0', array(&$this, 'check_for_existing_callback'), 10, 2);
}//-- function __construct
public function check_for_existing_callback($response, $results){
try {
if( false !== strpos($response, 'already exists') ) {
$output = 'Account or Email address already exists. Please try again.';
// set return results - text to attach to the end of the error
$results['errors'] = $output;
$results['message'] = $output;
//throw new Exception($output);
//die;
}
} catch(Exception $ex){
// indicate failure by adding errors as an array
$results['errors'] = array($ex->getMessage());
}
}
}//--- class Cf73rdParty_ExistingCallbacks
//start 'em up
$cf73rdpartycallback_instance = new Cf73rdParty_ExistingCallbacks();
endif; //class-exists
What I need is to push this error back to the form so that it stops the submit and informs the user. Any insight would be appreciated.