View Categories

Add registration form fields to Discussion Board

You can use the ctdb_registration_form_fields filter to add fields to your registration form. Below is an example of how this is done.

In your functions.php file, or other suitable place, add the following:

function rf_ctdb_registration_form_fields( $form ) {
  $form['ctdb_user_test'] = array(
    'id' => 'ctdb_user_test',
    'label' => __( 'Test', 'wp-discussion-board' ),
    'field' => 'input',
    'type' => 'text',
    'class' => 'required',
    'meta_key' => 'test_meta_key'
  );
  return $form;
}
add_filter( 'ctdb_registration_form_fields', 'rf_ctdb_registration_form_fields' );

You should:

  • Ensure the element key and id match.
  • Change the label to your field label
  • field should be ‘input’
  • type should be ‘text’
  • class should be ‘required’ if the field is required
  • meta_key is the name of the meta key where you’d like to field value to be saved