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

Cannot Reproduce Bug with Select control for custom user fields?

Discussion in 'Resolved Bug Reports' started by SchmitzIT, Jan 11, 2012.

  1. SchmitzIT

    SchmitzIT Well-Known Member

    While trying to create a custom drop-down field, I ran into some weird issues.

    1) The 'Add Additional Choice' button doesn't work for me under either 1.1.0 or 1.1.1. The only way to get additional fields to appear is entering the available field, saving, and then going back.

    However, I'm dealing with a list of 232 entries. So instead, I figured I would inject it into the database by means of a query. I anually created a drop-down list, with a single value in it, and then issued an UPDATE statement against the generated field :

            UPDATE xf110.xf_user_field
            SET field_choices = 'a:232:{s:6:\"aaland\";s:6:\"Aaland\";s:11:\"afghanistan\";s:11:\"Afghanistan\";s:7:\"albania\"; ... .s:8:\"zimbabwe\";s:8:\"Zimbabwe\";}'
            WHERE field_id = 'countryFlag';
    Instead of showing the text values, though, when expanding the drop-down field, it shows:


    etc. I hasten to add that I essentially replicated the format I saw when manually adding a few entries in a test-field prior to generating the serialized content (which I built a quick C# interpretor for).

    3) I need the above field for an add-on. However, when attempting to create a custom user field from scratch, by issuing an INSERT into the xf_user_field table, the title and description are missing, and when trying to open the custom field to inspect what came up in the options, the following error is thrown:

    [*][I]Invalid argument supplied for foreach()[/I]in C:\Program Files (x86)\Zend\Apache2\htdocs\xf110\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 251:
    250:                             ';
    251: foreach ($masterFieldChoices AS $choice => $text)
    252: { 
    I'm guessing that this hints at there being a second table that requires updating in case an add-on relies on a custom user field. The big question is: Which one?

    Thanks in advance :)
  2. Mike

    Mike XenForo Developer Staff Member

    The only thing that's really an issue here is that the "add additional choice" button doesn't work for you. The others come from the data not being inserted properly -- I could really only recommend using the data writer. There are a bunch of things to be updated.

    I can't reproduce the button not working. What browser?
  3. SchmitzIT

    SchmitzIT Well-Known Member

    I mainly use FireFox (9.0.1), IE for some reason is giving me trouble regardless of what I try.

    I can try and see if I can use something different :)
  4. Mike

    Mike XenForo Developer Staff Member

    Works for me in IE 7 - 9 as well.
  5. SchmitzIT

    SchmitzIT Well-Known Member

    I just tested it in Chrome, and it works for me there. Seem the most recent FireFox update messed it up.

    About this, would the proper path be to fire an INSERT at the database for adding the new custom field, or would I be best off mimicing the default XF functionality for adding a new custom field, and then using the data writer to fill in all the different data fields?
  6. Mike

    Mike XenForo Developer Staff Member

    I should note that Firefox 9.0.1 is fine for me too.

    If you're wanting to do inserts you should always be using a data writer if there's one for the data you want.

Share This Page