1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Changing custom user field ID after use

Discussion in 'XenForo Development Discussions' started by Marcel, Oct 26, 2015.

  1. Marcel

    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_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: Oct 26, 2015
  2. Chris D

    Chris D XenForo Developer Staff Member

    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.
  3. Marcel

    Marcel Active Member

    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?

Share This Page