Changing custom user field ID after use

Marcel

Active member
I understand the admin panel states that it cannot be changed once set.
I'm in the process of splitting one addon into two and would like to change the ID of a custom user field.

It seems it stores the ID it in

xf_user_field.field_id
and
xf_user_field_value.field_id (many times, one for each user with it set)

as Hex

I naively thought that manually updating these in the database to the new hex value would be a sneaky way round it. It seems to have updated the Custom User Field section in the admin panel, and everywhere else I can see.

However, when I try and dump the $user.customFields array into a template, it's still pulling the old ID.
I'm stumped, I can't find where it's referencing it from.
 
Last edited:
Just don't do this, is my advice :)

As well as the field_id being referenced there, it is also referenced in various caches in the data registry and on a per-user basis where their field values are cached.
 
Good enough an answer for me!
I suppose a way round it would be to create a new custom field with the new ID, then run an SQL query to basically duplcate from the old values to the new?
 
Back
Top Bottom