Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active June 10, 2019 18:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/b0e5a78edde80002e0c37eb4504918c7 to your computer and use it in GitHub Desktop.
Save billerickson/b0e5a78edde80002e0c37eb4504918c7 to your computer and use it in GitHub Desktop.
<?php
/**
* WPForms Email Blacklist
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/wpforms-email-blacklist
*
* @param string $honeypot, empty if not spam, honeypot text is used in WPForms Log
* @param array $fields
* @param array $entry
* @param array $form_data
*/
function be_wpforms_email_blacklist( $honeypot, $fields, $entry, $form_data ) {
// Use the email as the key. The value will be used in the log
$blacklist = array(
'info@ranksindia.com' => 'Ranks India',
);
foreach( $form_data['fields'] as $id => $field ) {
if( 'email' == $field['type'] && array_key_exists( $entry['fields'][$id], $blacklist ) )
$honeypot = '[Blacklist] ' . $blacklist[$entry['fields'][$id]];
}
return $honeypot;
}
add_filter( 'wpforms_process_honeypot', 'be_wpforms_email_blacklist', 10, 4 );
@carasmo
Copy link

carasmo commented Jun 10, 2019

I'm sorry to say that this doesn't work now.

@billerickson
Copy link
Author

It should still work. The filter is still in place in WPForms.

If you're having issues, I recommend contacting WPForms support.

@carasmo
Copy link

carasmo commented Jun 10, 2019

They are saying that it doesn't work because it's old. I have been in contact many times today. Oh well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment