User custom field with plugin


(SMHassanAlavi) #1

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?
@angus


(Andrew Leach) #2

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.


(Angus McLeod) #3

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.


Custom Layouts Plugin