Buddypress signup form hook

function bph_field_value() {
echo get_bph_field_value();
function get_bph_field_value() {
return apply_filters( 'get_bph_field_value', $_POST['bph_field'] );

function bph_check_validation(){
global $bp;
$bph_field_txt = $_POST['bph_field'];

if (empty($bph_field_txt) || $bph_field_txt == '') {
$bp->signup->errors['bph_field'] = __('This is a required field','buddypress');

function bph_show_input_field(){?>
<div style="float:right;width:268px;margin-right:4px;" class="bph_field_container">
<label>Input Field Name</label>
<?php do_action( 'bp_bph_field_errors' ) ?>
<input type="text" name="bph_field" id="bph_field" value="<?php bph_field_value() ?>" /><br />


add_action('bp_signup_validate', 'bph_check_validation');
add_action('bp_before_registration_submit_buttons', 'bph_show_input_field');


You must be logged in to post a comment.

  1. hi Adam,
    thanks for the useful snippet, I used it in my next BP theme.
    worked like a charm 😉

  2. Hello Adam,
    Thanks for the codes! I have 2 question need your help.
    I don't want to print a error message, can I just remove this line?

    Another question- Instead the error message, I prefer change the label color to red upon error. I wrote a code for this purpose.
    'function print_style_color() {
    global $bp;
    $errname = 'bp_' .bp_the_profile_field_input_name( ). '_errors';
    if ( !empty( $errname[echo $fieldname] ) )
    echo 'color:red';
    add_action ( 'print_style_color','print_style_color' );'
    For other bp fields, it works with 'if ( !empty( $bp->signup->errors['signup_password'] ) )' , but for bp-humanity, this $bp_signup_erro doesn't work. So, I try to use 'if ( !empty( $errname[echo $fieldname] ) )' , it doesn't work either.
    Would you suggest me what's wrong in my code?

  3. I have only used this code for validation, the buddypress humanity plugin I wrote just checks to see if you filled out the form with the right answer.

    From within your plugin / bp_signup_validate, you could probably just save the value of the input field to a wordpress option or to the database. Something like: add_option('myNewValue',$_POST['bph_field']);

    Then do whatever you want with that data.

  4. Ok, now that I've added field to the signup form, how can I use it?

    One option is to add whatever code I want to execute in function called by bp_signup_validate, but there is no guarantee that if my custom field validates some other field will not give error. So, where should I enter code that I want to execute against successful signup (using data from custom field that we just added)?