Registration Form

Replies
2
Voices
2
Freshness
Followers

0

I am planning to buy the pro version, however, I need one clarification. I need the phone number field on the registration form. I am not too good at coding so i need precise instructions on where to add this code given in the documentation.

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' );

 

  • GarethGareth

    Hi Amit

    Because WordPress user profiles don't have a phone number by default, you'd need to add one. A really good tutorial is at http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields - you'd just need the first two sections.

    Then you can use this code to include the phone number in your registration form:

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

    Any questions, just let me know.

    Thanks

    Gareth

    • I was able to add the phone_number User field (custom) in wordpress. Now where do I add the code that you have given. I bought the pro pluggin just now, but cant find a place to add this code. Can you tell me precisely where to add?