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

Unable to create userfield.

Discussion in 'XenForo Development Discussions' started by Renari, Dec 2, 2012.

  1. Renari

    Renari Member

            $dw = XenForo_DataWriter::create('XenForo_DataWriter_UserField');
            $dw->set('field_id', 'Field');
            $dw->set('display_group', 'contact');
            $dw->set('display_order', 130);
            $dw->set('field_type', 'textbox');
            $dw->set('match_type', 'none');
            $dw->set('user_editable', 'yes');
    From what I understand, this should add a new userfield in the contacts section named "Field" however from what I've seen it's doing nothing when run as an install method for an addon.
  2. Chris D

    Chris D XenForo Developer Staff Member

    Seems to be correct.

    Are you sure the install method is set up properly and is running?

    Any errors in the server error log?
  3. Renari

    Renari Member

    Are install routines run when you create a new addon and supply an install method? Also, not seeing any errors in the error log. Here's an example.

    Attached Files:

  4. Chris D

    Chris D XenForo Developer Staff Member

    The install routine is run when you install or upgrade an add-on (they run in the background, directly before the Rebuilding Caches page).

    So, basically upgrade the add-on with the XML file and the install should run.

    Everything seems fine, as far as I can tell. Not got time to install it myself and check, but it does seem ok.
  5. Renari

    Renari Member

    Thanks, it seems that the install routine is not run when you create a new addon from the development tab of the admin control panel. Uploading the XML for the add-on did indeed make it run and I found a new userfield added.
  6. Chris D

    Chris D XenForo Developer Staff Member

    That's right.

    Creating addon != installing :)

    Glad you got it sorted.

Share This Page