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

As Designed Custom User Field Phrases not staying associated with add-on

Discussion in 'Resolved Bug Reports' started by Steve F, Jul 15, 2014.

  1. Steve F

    Steve F Well-Known Member

    I have a add-on where I create some user fields upon install.


      $dw = XenForo_DataWriter::create('XenForo_DataWriter_UserField');
                $dw->set('field_id', 'steamUserProfile');
                $dw->set('display_group', 'contact');
                $dw->set('display_order', 1);
                $dw->set('field_type', 'textbox');
                $dw->set('required', 0);
                $dw->set('show_registration', 0);
                $dw->set('user_editable', 'yes');
                $dw->set('viewable_profile', '1');
                $dw->set('viewable_message', '1');
    When creating the add-on I made the custom user fields and then associated the user_field_steamUserProfile and user_field_steamUserProfile_desc with the add-on. Now anytime I go back and make a change to the custom user field it removes any association that it had with the add-on.

    Before editing user field

    After Editing user field


    When I say edit user field, all I did was open the user field to edit and hit save.
  2. Mike

    Mike XenForo Developer Staff Member

    User fields are "custom" and thus aren't associated with an add-on and as such, the phrases won't be either. You should simply create the phrases without an add-on.
  3. Sim

    Sim Well-Known Member

    What is the recommended way of soliciting preferences from a user in an add-on?

    User fields are an ideal way of asking for users to choose their preference or set custom profile information.

    However, since we can't directly associate a user field with an add-on, we potentially leave ourselves open to issues if we create the custom user field programattically during add-on installation - especially if the administrator then goes and edits the user field by hand.

    Is there a better way?
  4. Mike

    Mike XenForo Developer Staff Member

    You would need to create a preference field like the various "standard" preferences (new field in the DB, etc).
    Sim likes this.

Share This Page