User custom field with plugin

When I create a user_custom_field, the name in database is set custom_field1 or custom_field2 or… .

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?

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.

1 Like

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.

1 Like