Add a custom per-user setting in a plugin

I’m testing this here

and it builds fine. Not sure about functionality as I have never used the plugin and I have no idea what to test for.

The register_editable_user_custom_field method signature is a field name and an optional flag to mark it as staff_only, so as far as I can tell, passing an array to it is unexpected?


Yeah, it’s unusual?

But apparently David’s solution seems to resolve the issue.


  register_editable_user_custom_field :geo_location if defined? register_editable_user_custom_field
  register_editable_user_custom_field geo_location: {} if defined? register_editable_user_custom_field

breaks. this doesn’t:

 register_editable_user_custom_field [:geo_location,  geo_location: {}] if defined? register_editable_user_custom_field

Does look like the Ruby version forced this change though?

In any case I believe we have a solution and should update the OP?

I’ll need to make a change on one more plugin, and will update the wiki above if happy.


FYI seems to be working both building and functioning :tada:

Thanks for your help.


I think it’s this, Separation of positional and keyword arguments in Ruby 3.0


Hello :wave:

I’m trying to create a custom user field from a plugin but I’m not sure I fully understand what you’re describing here. In my plugin if I do:

register_editable_user_custom_field 'foo'

Should I still use plugin outlets connectors to display it on the user profile and the user card?

Or is there a mechanism like the custom field in the admin that can add it automatically (including in the users directory)? I want to avoid adding connector and serializer field if there is already a way to do this.

Thanks for your help!

1 Like


1 Like

Hello @merefield, thanks for the link but it’s not what I’m asking. Looks like it’s to make custom field created in the admin non-visible except with a staff API key.

If I am unclear, let me reformulate: is there a way to register a custom user field with a plugin, just like we can do within the admins “User Fields” (editable, searchable, shown on user profile, on user card, etc)?


Apologies, I wonder if this might be more helpful then?:

The main models all have a Custom Field capability.