Skip to content

Commit

Permalink
New. Integrations. Added handler for jetformbuilder.
Browse files Browse the repository at this point in the history
  • Loading branch information
svfcode committed Dec 1, 2023
1 parent e6b4b48 commit 206d90f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cleantalk.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,15 @@ function apbct_write_js_errors($data)
apbct_givewp_donate_request_test();
}

// JetformBuilder
if (
!empty($_POST) &&
apbct_is_plugin_active('jetformbuilder/jet-form-builder.php') &&
Get::get('jet_form_builder_submit') === 'submit'
) {
apbct_jetformbuilder_request_test();
}

add_action('wp_ajax_nopriv_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
add_action('wp_ajax_ninja_forms_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
add_action('wp_ajax_nopriv_nf_ajax_submit', 'apbct_form__ninjaForms__testSpam', 1);
Expand Down
33 changes: 33 additions & 0 deletions inc/cleantalk-public-integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -3979,3 +3979,36 @@ function apbct_memberpress_signup_request_test()

$cleantalk_executed = true;
}

function apbct_jetformbuilder_request_test()
{
global $ct_comment;

$input_array = apply_filters('apbct__filter_post', $_POST);
$params = ct_gfa($input_array);

$base_call_result = apbct_base_call(
array(
'sender_email' => $params['email'],
'sender_nickname' => $params['nickname'] ?: '',
'post_info' => array('comment_type' => 'jetformbuilder_signup_form'),
)
);

$ct_result = $base_call_result['ct_result'];

if ((int)$ct_result->allow === 0) {
if (Get::get('method') === 'ajax') {
$msg = '<div class="jet-form-builder-message jet-form-builder-message--error">' . $ct_result->comment . '</div>';
wp_send_json(
array(
'status' => 'failed',
'message' => $msg
)
);
} else {
$ct_comment = $ct_result->comment;
ct_die(null, null);
}
}
}

0 comments on commit 206d90f

Please sign in to comment.