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

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

Discussion in 'XenForo Questions and Support' started by Alfa1, Apr 11, 2014.

  1. Alfa1

    Alfa1 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?
  2. Brogan

    Brogan XenForo Moderator Staff Member

    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.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Alfa1 likes this.
  4. HWS

    HWS Well-Known Member

    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.
    Alfa1 likes this.
  5. Tracy Perry

    Tracy Perry Well-Known Member

    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).
    Amaury likes this.
  6. Alfa1

    Alfa1 Well-Known Member

    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.
    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.
    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: Apr 12, 2014
  7. HWS

    HWS Well-Known Member

    No, it won't.
    We have a pretty large board and it works without problems. Cron also works behind the scenes, so it won't effect UI and UE.
    Alfa1 likes this.
  8. Alfa1

    Alfa1 Well-Known Member

    Still: having 2 location fields is confusing and will result in support tickets and confused users repeatedly updating the wrong field.
  9. HWS

    HWS Well-Known Member

    You need to hide the default field from all user interactions via template edits.
  10. Alfa1

    Alfa1 Well-Known Member

    Isn't it just as easy to replace the default field with the custom one via the same template edits?
  11. Amaury

    Amaury Well-Known Member

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

    Jake Bunce XenForo Moderator Staff Member

    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.
  13. Alfa1

    Alfa1 Well-Known Member

    then how do we get all new content in that field standardized and mandatory?
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Oh right. You need the custom user field for that.

    I suggest creating an addon to make the default location field required.
    Alfa1 likes this.
  15. Alfa1

    Alfa1 Well-Known Member

    Yes, and adding a drop down with predefined locations to it.
    Joe Link likes this.

Share This Page