Skip to:

passphrase on registration

  • sixf00t4


    I’m trying to make registering on the site require a passphrase to complete the registration (a form of spam filtering / needing to be human).

    when I go through the steps, to register, the field is there, and if entered correctly, it works, but if it’s blank, or just wrong, it just kicks me to a white screen error with:

    “There has been a critical error on this website.

    Learn more about troubleshooting WordPress.”

    It would seem something is wrong with the error handling in my function. help?

    function bp_add_passphrase_field() {
      <div class="register-section" id="profile-details-section">
        <div class="editfield">
          <label for="passphrase"><?php _e( 'What sport do the Steelers play?', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
          <input type="password" name="passphrase" id="passphrase" value="" />
    add_action( 'bp_before_registration_submit_buttons', 'bp_add_passphrase_field' );
    // Validate the custom passphrase field on form submission
    function bp_validate_passphrase_field( $result ) {
      // Set the desired passphrase
      $correct_passphrase = 'football';
      if ( $_POST['passphrase'] != $correct_passphrase ) {
        $result['errors']->add( 'passphrase_error', __( 'The passphrase you entered is incorrect.', 'buddypress' ) );
      return $result;
    add_filter( 'bp_signup_validate', 'bp_validate_passphrase_field' );
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar