Title: [Plugin: Theme My Login] Additional fields in register-form.php
Last modified: August 19, 2016

---

# [Plugin: Theme My Login] Additional fields in register-form.php

 *  Resolved Anonymous User 5580574
 * (@anonymized-5580574)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/)
 * Hello,
 * I’d like to add some text-fields in the registration form:
 * firstname
    lastname website
 * …so the ‘official’ fields from wordpress. In my case it should be set obgligatory
   during the registration process.
 * Thx!
    Sebastian
 * [http://wordpress.org/extend/plugins/theme-my-login/](http://wordpress.org/extend/plugins/theme-my-login/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064551)
 * Copy register-form.php into your current theme’s directory and edit it as you
   see fit.
 * Please note that simply adding the fields will not save the data. You will need
   to use provided hooks to achieve your desired results.
 * You will want to use `registration_errors` to require fields and `tml_new_user_registered`
   to save the data.
 *  Thread Starter Anonymous User 5580574
 * (@anonymized-5580574)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064693)
 * > You will need to use provided hooks to achieve your desired results.
 * Could you specify it? I’m not quite familiar in this stuff :/ So if I would add
   a new input for the available ‘user_company’ like
 * `<input style="width:300px;height:34px;line-height:27px;border:1px solid #ececec;
   outline:none;padding-left:5px;color:#585858;float:left; background:url(/images/
   search_bg.png);" type="text" name="user_company" id="user_company<?php $template-
   >the_instance(); ?>" class="input" value="<?php $template->the_posted_value( '
   user_company' ); ?>" size="20" />`
 * …it would safe the infos?
 *  Plugin Author [Jeff Farthing](https://wordpress.org/support/users/jfarthing84/)
 * (@jfarthing84)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064695)
 * Create `/wp-content/plugins/theme-my-login-custom.php` and add [this code](http://pastebin.com/qeDBwz5a)
   to it.
 * After that, you will be able to access the property via the WP_User object: `
   $user->user_company`.
 *  Thread Starter Anonymous User 5580574
 * (@anonymized-5580574)
 * [15 years ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064702)
 * This sounds really really great, thank you for this! And If I’d like to offer
   the fields user_company and e.g. user_telephone… BUT only make the user_company
   obligatory, I only need to add the user_company to the registration_errors-function?
 *  [KyleEmmm](https://wordpress.org/support/users/kyleemmm/)
 * (@kyleemmm)
 * [15 years ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064709)
 * I don’t believe so…I’m following this as I’m looking to make some changes to 
   the `register-form.php` file as well.
 * Don’t quote me on this, but I think Jeff is saying that you will have to enter
   new `registration_errors` and new `tml_new_user_registered` variables to the `
   theme-my-login-custom.php` file for each additional item you wish to add to your`
   register-form.php` file. Jeff’s example only shows how to add a line for Companies(
   user_company, empty_company).
 *  Thread Starter Anonymous User 5580574
 * (@anonymized-5580574)
 * [15 years ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064713)
 * Hello Kyle, thx for your reply! This sounds complicated, a bit too complicated,
   so I guess I should avoid adding additional and obligatory registration-fields.
   Hopefully, Jeff will include this option (custom-fields) as an future feature
   one day. Thx for you work and fast support! Sebastian
 *  [Saabana](https://wordpress.org/support/users/saabana/)
 * (@saabana)
 * [15 years ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064749)
 * hello
    I add some extra fields ` <p> <label for=”first_name”><?php _e( ‘First
   name’, ‘theme-my-login’ ) ?></label> <input type=”text” name=”first_name” id=”
   first_name<?php $template->the_instance(); ?>” class=”input” value=”<?php $template-
   >the_posted_value( ‘user_first_name’ ); ?>” size=”20″ maxlength=”255″ alt=”First
   Name” /> </p> <p><label for=”last_name”><?php _e( ‘Last name’, ‘theme-my-login’)?
   ></label> <input type=”text” name=”last_name” id=”last_name<?php $template->the_instance();?
   >” class=”input” value=”<?php $template->the_posted_value( ‘user_last_name’ );?
   >” size=”20″ maxlength=”255″ alt=”Last Name” /> </p> <p> <label for=”user_phone
   <?php $template->the_instance(); ?>”><?php _e( ‘Phone’, ‘theme-my-login’ ) ?>
   </label> <input type=”text” name=”user_phone” id=”user_phone<?php $template->
   the_instance(); ?>” class=”input” value=”<?php $template->the_posted_value( ‘
   user_phone’ ); ?>” size=”20″ /> </p>
 *     ```
       and also I Create /wp-content/plugins/theme-my-login-custom.php and add some code to it.
       ```
   
 * <?php
 * function registration_errors( $errors ) {
    if ( empty( $_POST[‘user_phone’] ))
   $errors->add( ’empty_phone’, ‘<strong>ERROR</strong>: Please enter your phone
   number.’ ); return $errors; } add_action( ‘registration_errors’, ‘registration_errors’);
 * function tml_new_user_registered( $user_id ) {
    update_user_meta( $user_id, ‘
   user_phone’, $_POST[‘user_phone’] ); } add_action( ‘tml_new_user_registered’,‘
   tml_new_user_registered’ );
 * ?>`
    and still didn’t get the field working for store data in profile form and
   error when left my phone empty and thanks for this plugin

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: Theme My Login] Additional fields in register-form.php’ is closed
to new replies.

 * ![](https://ps.w.org/theme-my-login/assets/icon-256x256.png?rev=1891232)
 * [Theme My Login](https://wordpress.org/plugins/theme-my-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/theme-my-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/theme-my-login/)
 * [Active Topics](https://wordpress.org/support/plugin/theme-my-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/theme-my-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/theme-my-login/reviews/)

## Tags

 * [field](https://wordpress.org/support/topic-tag/field/)
 * [first name](https://wordpress.org/support/topic-tag/first-name/)
 * [form](https://wordpress.org/support/topic-tag/form/)
 * [last name](https://wordpress.org/support/topic-tag/last-name/)
 * [website](https://wordpress.org/support/topic-tag/website/)

 * 7 replies
 * 4 participants
 * Last reply from: [Saabana](https://wordpress.org/support/users/saabana/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/plugin-theme-my-login-additional-fields-in-register-formphp/#post-2064749)
 * Status: resolved