# User custom field with plugin

**URL:** https://meta.discourse.org/t/user-custom-field-with-plugin/62035
**Category:** Development
**Created:** [May 3, 2017, 11:07am UTC](https://meta.discourse.org/t/user-custom-field-with-plugin/62035 "2017-05-03T11:07:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Alavi1412](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alavi1412/32/67721_2.png) [@Alavi1412](https://meta.discourse.org/u/Alavi1412)
#### Post date: [May 3, 2017, 11:07am UTC](https://meta.discourse.org/t/user-custom-field-with-plugin/62035/1 "2017-05-03T11:07:46Z")

</div>

When I create a user\_custom\_field, the name in database is set custom\_field1 or custom\_field2 or… .

 ![](https://global.discourse-cdn.com/meta/original/3X/8/c/8cd6b8e89e75b471fba8e80ff1fd1eb7ac19c8db.png)  
But I want to set a specific name to this user\_custom\_field because I want to change this custom field at plugin.rb with running a SQL Query and the problem is how can I SELECT that user\_field?  
@angus

---

<div class="post-metadata">

### Author: ![leachad](https://avatars.discourse-cdn.com/v4/letter/l/aca169/32.png) [@leachad](https://meta.discourse.org/u/leachad)
#### Post date: [May 4, 2017, 2:22pm UTC](https://meta.discourse.org/t/user-custom-field-with-plugin/62035/2 "2017-05-04T14:22:55Z")

</div>

I am somewhat of a Ruby novice, but I think that you have to add an attribute to the user model called ‘value’. This shouldgive you access to all attributes of the user record.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [May 5, 2017, 10:30pm UTC](https://meta.discourse.org/t/user-custom-field-with-plugin/62035/3 "2017-05-05T22:30:10Z")

</div>

There is a difference between User Field you create via the admin panel, which will get assigned a random number (an id actually), and a `user_custom_field` which you create yourself in a plugin. There are many examples of the latter in various plugins. In fact there is a [topic about it on meta](https://meta.discourse.org/t/custom-user-fields-for-plugins/14956).
