Adding the field to the new user signup page

BuddyPress options > Components > Extended Profiles = On

Users > Profile Fields

Add the new field and mark it as required for signups

Validating the value entered
//******************************************************************
//******************************************************************
//********** NEW USER REGISTRATION CHECK FIELDS SUBMITTED **********
//******************************************************************
//******************************************************************
add_action ('bp_signup_pre_validate', 'myplugin_bp_signup_pre_validate', 20);
function myplugin_bp_signup_pre_validate()
{
  global $bp;

  //----- CHECK SIGNUP CODE VALUE ENTERED -----
  if (!isset($_POST['field_2']) || $_POST['field_2'] !== 'ABC')
  {
    //Error - Cause signup to fail
    $bp->signup->errors['field_2'] = 'ERROR - My validation error message';   //Field name must be correct for error message to be shown next to the field
  }
  
}
Hiding “This field can be see by” message under fields

Add this to your themes style.css

/* Hide "This field can be see by" on registration and edit profile pages */
.field-visibility-settings-toggle {
display:none;
}
.field-visibility-settings-notoggle {
display:none;
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *