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

XF 1.5 Changing Custom User Field Data Via MySQL

Discussion in 'XenForo Questions and Support' started by Divvens, Oct 9, 2016.

  1. Divvens

    Divvens Well-Known Member

    I have a custom user field that contains numbers and commas, I need to strip out all the commas from this custom user field and convert it to an integer type.

    I'm not an expert when it comes to phpmyadmin and I don't want to spend lots of time doing this manually, what would be the query to run for such a task?
  2. Chris D

    Chris D XenForo Developer Staff Member

    If you go through with this, you certainly should be taking a backup of your database first, and be prepared to restore that backup in case anything goes wrong.

    The query would be something like:
    UPDATE xf_user_field_value
    SET field_value = REPLACE(field_value, ',', '')
    WHERE field_id = '???';
    Change ??? to the ID of the custom field.

    Once you have done this, you need to go to Admin CP > Tools > Rebuild Caches and rebuild all users - part of this process rebuilds the cached custom field values from the xf_user_field_value table.
    Divvens likes this.

Share This Page