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;
}
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

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