Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • vergellan

    (@vergellan)

    You can use custom trim excerpt function and put the str_replace into it. And then add the lines to entry template:

    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'improved_trim_excerpt');

    1. You can put this hook code to the functions.php

    add_action('cforms2_after_processing_action', function ($cformsdata) {
      wp_mail('[email protected]', 'my_cforms_logic test', print_r($cformsdata,1), 'From: [email protected]');
    });

    This will show you the structure of $cformsdata data array which contains the whole form values (the both emails fields)

    2. After that you can change the hook and throw the exception like this

    add_action('cforms2_after_processing_action', function ($cformsdata) {
        if ($cformsdata['data'][email1-...] != $cformsdata['data'][email2-...])
            throw new Exception('email address do not match!');
    });
    Thread Starter vergellan

    (@vergellan)

    Thanks for your advice, looks like it’s working.
    I have put a check of $_SERVER['HTTP_REFERER'] in add_action(‘cforms2_after_processing_action’, function ($cformsdata) {…} section.
    But I think I found an error in the file lib_validate.php on line 799.

            if ($cformsSettings['form' . $no]['cforms' . $no . '_emailoff'] == '1') {
                $sentadmin = 1;
            } else {
                // This filter allows manipulation of the admin email just before sending
                $mail = apply_filters('cforms2_admin_email_filter', $mail, $no, $pid);
                $sentadmin = $mail->send();
            }

    When we catch an Exception from do_action(‘cforms2_after_processing_action’, $trackf) this loop does not take into account the $sentadmin = 1 value from the Exception and still send an email to admin.

    • This reply was modified 6 years, 1 month ago by vergellan.
    Thread Starter vergellan

    (@vergellan)

    Thanks for the reply.

    We use this CformsII form as a widget in the sidebar. When I test it from the mainpage – Ive got the message with the {Page} property contains the domain name of the site, so it is not very clear where slash character comes from. I also do not really think that the using of Google recaptcha can change the situation, because when we used the text Q-A captcha as well as when we used a graphic Really Simple captcha the spam emails came from the same IPs. Therefore, I would like to understand whether it is possible that the spammers can use direct requests to the plugin`s mail files.

    • This reply was modified 6 years, 1 month ago by vergellan.
Viewing 4 replies - 1 through 4 (of 4 total)