Creating and configuring custom user fields

I think you could reorder them with the rails console. I chose to enter the fields with their IDs because it’s more difficult to type a name without typos

ids_in_order = [3, 7, 8, 5, 1, 2]

ids_in_order.each_with_index do |id, index|
  UserField.find(id).update!(position: index)
end
1 Like

Here is what the “reorder categories” window looks like. I’m guessing if this exists in Discourse there could be a way to use it for user fields too?

1 Like

I don’t believe so, but I recently wrote a theme component that hides the original display of custom fields on the user card and profile pages and then renders them again, optionally making some HTML-safe (they are adding some info via the API to a custom field that users can’t edit). I think the same idea could be used to add an order field to the custom fields to change the order they are displayed on the card and/or profile.

I think you can use the existing methods for reordering the user fields. It is a little impractical that you have to open the menu again after every position change. This is somewhat annoying when moving across several positions.

But a component that would make the buttons always visible or a checkbox for a “reorder mode” at the top that makes them visible outside the menu could already improve the experience.

1 Like

Oh. Funny. Yeah. Oops. That’s tons better than my idea. :rofl: