I have Breaked my lance searching over english and russian manuals
Info: I`m running site on the Wordpress platform. Its contact form is WordpressContactForm7.
The Issue: spam is beeing REPEATEDLY sent 5-7 times a day through the contact form to my callcenter`s email.
My work: I made simple spam filter in php that block common phrases and emails, that beeing found in body of message - makes its spam-rating hotter and hotter.
Everything after spam-level 90% is blocked. Everything after 60% must block user to 1-email-a-day- mode
The Problem : I could not find any proper place in WPCF7 phpcode to inject my own.
I am new to wordpress and could find only two entry-points: 1) virtual address of data-processor sitename.com/wp-json/contact-form-7/v1/contact-forms/46550/feedback that is virtual and tells me nothing about the place where wpcf7 have server-processing and sending to my mail.
2) installation ZIP of contact-form-7 plugin Also it has lots of everything - And I watched through carefully - but I found I cannot make a full image of it in my mind /
So I decided to ask for the help the experienced coder to show off the different ways to deal with that.
P.S.
(Note1 I am a little affraid of WP, and prefer to rely on my own raw php skills and build-from-zero code constructions. Im much better dealing the code done by me rather than somebody outer
s.)
(Note2 I ve heard that json api is vuln...)
(Note3 I`m afraid of updating any components - the cause is that WP is controlled and carried by superirors - so any my fault can be the last one^)
Please Kindly consult me on the topic, If possible <3 Thank You
CF7 have a lot of hooks and filters actually, like wpcf7_skip_mail
,wpcf7_mail_sent
,wpcf7_before_send_mail
and others..
e,g:
add_action( 'wpcf7_before_send_mail', 'wpcf7_my_before_send_mail' );
function wpcf7_my_before_send_mail( $wpcf7 ) {
// put your logic code here
}
the following is special for skipping mail
add_filter( 'wpcf7_skip_mail', function( $skip_mail, $contact_form ) {
if( /* your logic */ )
$skip_mail = true;
return $skip_mail;
}, 10, 2 );
combining this logic, you can also do something like
add_action("wpcf7_before_send_mail", "wpcf7_do_something");
function wpcf7_do_something($cf7) {
// this is the contact form object
$wpcf = WPCF7_ContactForm::get_current();
// exam0ple : ID of Form $wpcf->id
if (/*your logic here*/) {
// If you want to skip mailing...
$wpcf->skip_mail = true;
}
return $wpcf;
}
you should also look at the CF7 Docs, you could find some other ways of fighting spam like ip_blacklist and other tips