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

Fixed Serious bug with custom user fields

Discussion in 'Resolved Bug Reports' started by HWS, Jun 14, 2012.

  1. HWS

    HWS Well-Known Member

    We use a custom user field, require it at registration, but do not want users to change it afterwards via account settings. As per your instructions, we set up a custom user field and mark it "Editable only once" under "General Options".

    Now, if a user registers and sends the register form with errors, the register screen shows again, this time with an error message where the details of the error are specified.

    BUT, and this is a major bug, all custom user fields specified with "Editable only once" (even IF required and sent empty or with a wrong value/error message the first time) do NOT show up again!

    So a new user CAN successfully register without the required custom user field.

    Please specify a bug fix to solve this, we need to patch our installation urgently.

    Thank you.
    Brent W, ragtek and Mopquill like this.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Confirmed in 1.1.2.

    To reproduce I created two required "editable once" fields. I visited the registration form and filled in only one of the required fields. Upon submit it gives an error on the empty field and displays it again. But the required field that I filled in is now missing from the registration form. The software takes the entered value as having satisfied the "editable once" field even though it wasn't saved.
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It's a unique situation with the registration form because it reloads the form on submit errors. This doesn't happen anywhere else.

    One fix would be to modify the templates:

    Admin CP -> Appearance -> Templates -> register_form

    Replace this:

    	<xen:include template="custom_fields_edit" />
    With this:

    	<xen:include template="custom_fields_edit">
    		<xen:set var="$registration">1</xen:set>
    Admin CP -> Appearance -> Templates -> custom_fields_edit

    Add the red code:

    <xen:foreach loop="$customFields" value="$field">
    	<xen:if is="{$field.isEditable} OR ({$registration} AND {$field.user_editable} == 'once')">
    		<xen:include template="custom_field_edit" />
    Or another solution would be to implement this check in the controller and model. Add a flag to these functions:


    And then set that flag in the controller:

    TheVisitors, Yorick and Mopquill like this.
  4. HWS

    HWS Well-Known Member

    Thank you. Both bug fixes do work. :)
  5. Kier

    Kier XenForo Developer Staff Member

    R_A, pipedreams and Lost like this.
  6. amit39

    amit39 Member

    Thank you brother!
  7. swatme

    swatme Well-Known Member

    kier just wondering, when you say fixed.
    the fixed will be included in the next release version of xf?
  8. principia

    principia Well-Known Member

    yes as always.
  9. HWS

    HWS Well-Known Member

    It has been released with 1.1.3
    Otherwise you can use the fixes posted above by Jake. Both of them solve this issue.

Share This Page