<p>You can add custom fields to users the same way as you do for entries, categories, and all other elements in Craft. Create a custom field for middle name, and go to Settings > Users > Fields and add that field to the field layout.</p>

<p>EDIT:<br>
The field will show in the profile tab, and there is no way to properly add fields to the account tab, even with a plugin. But, although a bit hacky, you could do this by just moving the field with javascript.</p>

<p>First, install the <a href="https://github.com/lindseydiloreto/craft-cpjs" rel="nofollow">Control Panel JS plugin</a> by Lindsey DiLoreto. Read the docs on how to get the plugin to load your custom js-file.</p>

<p>Each custom field in the form has an id with the naming convention <code>fields-myCustomFieldHandle-field</code>. If you name the field <code>middleName</code> and want to put it before the email field on the account tab, you could do something like this:</p>

<pre><code>$(function () {
    if ($('#userform').length&gt;0) { // just to make sure we're in the user edit page
       $('#email-field').before($('#fields-middleName-field'));
    }
});
</code></pre>

<p>Getting it to appear between the first and last name fields, or making them 100% width and putting the middlename in the middle, would also be possible, but requires a bit more DOM manipulation. Let me know if this is important for you.</p>

CC BY-SA 3.0
2015-02-19T20:21:05.197Z
Thanks for the reply. I did figure this much out but preferably the new "middle name" field would display under the account tab instead of the profile tab. My assumption is this would have to happen via a plugin. Am I right or is there some other avenue I should take? If this should be done with a plugin can you give me some direction? I'm a newbie to Craft CMS.
Matt V
CC BY-SA 3.0
2015-02-19T20:44:58.610Z
@MattV I don't think it's possible to add extra fields to the account tab, even with a plugin.
carlcs
CC BY-SA 3.0
2015-02-19T22:51:36.937Z
@MattV I've updated my answer with a javascript solution for moving the field into the account tab.
André Elvan
CC BY-SA 3.0
2015-02-19T19:49:13.527Z
2015-02-19T22:48:58.460Z
2015-02-19T22:48:58.460Z
André Elvan
<p>Users, by default, do not have middle names. So let's say I create a table with a foreign key linking to the user id, this table will contain middle names. How would I tell craft to join the middle name data? Could I create a plugin with a hook that gets middle name whenever user data is pulled? Where do I begin?</p>

<users><user-profile>
How to pull extra data with a user
# How to pull extra data with a user

(Asked by: username_0 on 2015-02-19)

Users, by default, do not have middle names. So let's say I create a table with a foreign key linking to the user id, this table will contain middle names. How would I tell craft to join the middle name data? Could I create a plugin with a hook that gets middle name whenever user data is pulled? Where do I begin?

**Tags:** users, user-profile

---

## 1 answers

### Answer by username_1 on 2015-02-19. Score: 3

You can add custom fields to users the same way as you do for entries, categories, and all other elements in Craft. Create a custom field for middle name, and go to Settings > Users > Fields and add that field to the field layout.
EDIT:
The field will show in the profile tab, and there is no way to properly add fields to the account tab, even with a plugin. But, although a bit hacky, you could do this by just moving the field with javascript.
First, install the Control Panel JS plugin by Lindsey DiLoreto. Read the docs on how to get the plugin to load your custom js-file.
Each custom field in the form has an id with the naming convention fields-myCustomFieldHandle-field. If you name the field middleName and want to put it before the email field on the account tab, you could do something like this:
$(function () {
    if ($('#userform').length>0) { // just to make sure we're in the user edit page
       $('#email-field').before($('#fields-middleName-field'));
    }
});

Getting it to appear between the first and last name fields, or making them 100% width and putting the middlename in the middle, would also be possible, but requires a bit more DOM manipulation. Let me know if this is important for you.

> **Comments:**
> **username_0**: Thanks for the reply. I did figure this much out but preferably the new "middle name" field would display under the account tab instead of the profile tab. My assumption is this would have to happen via a plugin. Am I right or is there some other avenue I should take? If this should be done with a plugin can you give me some direction? I'm a newbie to Craft CMS.  
> **username_2**: @MattV I don't think it's possible to add extra fields to the account tab, even with a plugin.  
> **username_1**: @MattV I've updated my answer with a javascript solution for moving the field into the account tab.  

---

