我按照这条指令编写了一个表单挂钩:来自作者的第三方集成插件 (https://github.com/zaus/forms-3rdparty-integration#hooks)
add_action(' Forms3rdPartyIntegration_service_a#',$ response,$ param_ref);
每个服务的挂钩,由#表示 - 这是在' Hooks'中给出的。每项服务的部分
提供一个函数,它接受$ response,& $ results作为参数允许您对服务响应执行进一步处理, 并直接改变处理结果,以数组形式提供('成功' => false,'错误' => false,' attach' =>&# 39;',' message' =>'');
success = true或false - 更改服务请求是否被视为"更正"或不 errors =要返回表单的错误消息数组 attach =要附加到电子邮件正文末尾的文本
message =表单下方显示的消息通知(来自CF7 ajax响应) 注意基本"成功条件"可以通过后期处理来增强
我想出了这个函数,并将它添加到我的functions.php中,但它不起作用。我做错了吗?
if(!class_exists('Cf73rdParty_custom_message')){
class Cf73rdParty_custom_message {
public function __construct(){
//actions require 2 parameters: 3rd-party response, results placeholders
///NOTE: customize this hook name to match your Service (in the admin settings)
add_action('Forms3rdPartyIntegration_service_a7', array(&$this, 'adjust_response'), 10, 2);
}//-- function __construct
public function adjust_response($response, &$results) {
if(!empty($response['body'])){
if($response['body'] = 'CustomerExists');
{ $response['success'] = 'false';
$results['errors'] = array('User already exists');
$results['message'] = 'A trial for this customer already exists';
}
}
}
}
}
$Cf73rdParty_custom_message_ins = new Cf73rdParty_custom_message(); // attach hook