XF 1.3 How do I make xenforo use the correct location field?

Alpha1

Well-known member
In vbulletin I use a different location field (custom user field) because that allows me to implement a drop down for locations. XenForo imported this nicely, but now I have two location fields. How do I make xenforo use the correct field?
 
You could hide the default field by editing the templates or via CSS.
If you want your custom field to show in its place, that would require template edits, and possibly more, depending on the template and whether the params are available.
 
Depends on what you want.

If you want to maintain your location selector, go with Brogans solution and hide the default field. But the default location field is used for several other things, so you'll loose them too.

If you want your users to be able to freely insert text as location, go with Jake and just make an SQL call to move the data in your database to the default field (which can be changed by the users as they like).

Or go with the solution, we use at our forum. Just create a daily cron which overwrites the default field with the custom field (SQL call similar to Jakes) and hide the default location field in the account management for your users.

The handling of user fields is one of the most annoying things in XenForo. To be exact the inflexibility of the "default" fields. You cannot force users to select their gender, you cannot let them select their location from predefined values, etc., out of the box in Xenforo. All of that need add-ons…

Should be changed in a future version IMHO.
 
I would love to see some of the default fields be able to be made as a mandatory... but then you would end up with some real doofus ones (for example, one of my users put his location as "Trailer in yard" - guess that's better than the dog house though :D).
 
I need my international users to select their location (mandatory) from predefined values. (Countries & states) From there I assign them to social groups and polls which relate to their country or state. I do have one option for users who do not want to give their location (earth) but at least this method provides me with standardized location values which can be used for further functionality.
Or go with the solution, we use at our forum. Just create a daily cron which overwrites the default field with the custom field (SQL call similar to Jakes) and hide the default location field in the account management for your users.

This is the quickest workaround, but will give the user 2 location fields which is confusing. I do wonder if this will be problematic for a big board.
The handling of user fields is one of the most annoying things in XenForo. To be exact the inflexibility of the "default" fields. You cannot force users to select their gender, you cannot let them select their location from predefined values, etc., out of the box in Xenforo. All of that need add-ons…

Should be changed in a future version IMHO.
Yes, you are so right. Profile fields and profiles seem to be left behind in functionality. Hopefully they will get some love in future releases. There is a lot of potential there, especially in the age of social media popularity.
 
Last edited:
I would love to see some of the default fields be able to be made as a mandatory... but then you would end up with some real doofus ones (for example, one of my users put his location as "Trailer in yard" - guess that's better than the dog house though :D).

I'd personally never make location mandatory, but other fields like sex I would.
 

The implication here is that you should use the query to copy imported location data to XF's default location field, then delete the imported location field.

The default location field is integrated into XF's profile system so you should use that one. It is easy to remove the imported custom user field... and not so easy to remove the built-in location field.
 
Top Bottom