Fixed Account details edit form: bug, if birthday month and day is entered, but not the year


Well-known member
Affected version
If a user has entered a month and day for the birthday inputs, they cannot edit the birthday anymore, but the input fields are still shown.

The reason is this part of the template account_details.

                <xf:if is="{{ $xf.visitor.Profile.dob_day && $xf.visitor.Profile.dob_month && $xf.visitor.Profile.dob_year }}">
                        label="{{ phrase('date_of_birth') }}"
                        explain="{{ phrase('once_your_birthday_has_been_entered_it_cannot_be_changed') }}">

                        <xf:set var="$birthday" value="{{ $xf.visitor.Profile.getBirthday(true) }}" />
                        {{ date($birthday.timeStamp, $birthday.format) }}
                <xf:else />
                    <xf:macro template="helper_user_dob_edit" name="dob_edit" arg-dobData="{$xf.visitor.Profile}" />

Possible fix: change first line of the code above.
                <xf:if is="{{ $xf.visitor.Profile.dob_day && $xf.visitor.Profile.dob_month }}">

But I would find it even better, if a user who has already saved day and month could also save a year, if they want, later.

Chris D

XenForo developer
Staff member
We're fixing this, but in a slightly different way.

You should be able to edit your date of birth as long as it hasn't been fully completed. So the logic in the template is currently correct (showing the fields when the year hasn't been entered) but the logic in the code is now such that any of the values can be changed until the date is fully set, then it is locked.

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
Ensure the date of birth can be changed on a user's profile until it has been fully completed before it is locked.
Any changes made as a result of this issue being resolved may not be rolled out here until later.