Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
// Hook into the BuddyPress registration form
add_action( 'bp_after_signup_profile_fields', 'add_honeypot' );
* Add a hidden text input that users won't see
* so it should always be empty. If it's filled out
* we know it's a spambot or some other hooligan
function add_honeypot() {
echo '<div style="display: none;">';
echo '<input type="text" name="oh_no_you_dint" id="sucka" />';
echo '</div>';
// Validate the input
add_filter( 'bp_core_validate_user_signup', 'check_honeypot' );
* Check to see if the honeypot field has a value.
* If it does, return an error
function check_honeypot( $result = array() ) {
global $bp;
if( isset( $_POST['oh_no_you_dint'] ) && !empty( $_POST['oh_no_you_dint'] ) )
$result['errors']->add( 'pjbp_honeypot', __( "You're totally a spammer. Go somewhere else with your spammy ways." ) );
return $result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.