MyBB Community Forums

Full Version: Restrict DOB Modification
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using the Date of Birth on Registration plugin by Matt Rogowski to collect birth dates and deny users under a certain age. However, I would like to disable the option of editing date of birth after registration, to avoid circumventing certain rules/custom tools on the site.

When removing this from usercp_profile errors are thrown when trying to modify any profile fields or other settings on this page.
<tr>
<td colspan="3"><span class="smalltext">{$lang->birthday}</span></td>
</tr>
<tr>
<td>
<select name="bday1">
<option value="">&nbsp;</option>
{$bdaydaysel}
</select>
</td>
<td>
<select name="bday2">
<option value="">&nbsp;</option>
<option value="1" {$bdaymonthsel['1']}>{$lang->month_1}</option>
<option value="2" {$bdaymonthsel['2']}>{$lang->month_2}</option>
<option value="3" {$bdaymonthsel['3']}>{$lang->month_3}</option>
<option value="4" {$bdaymonthsel['4']}>{$lang->month_4}</option>
<option value="5" {$bdaymonthsel['5']}>{$lang->month_5}</option>
<option value="6" {$bdaymonthsel['6']}>{$lang->month_6}</option>
<option value="7" {$bdaymonthsel['7']}>{$lang->month_7}</option>
<option value="8" {$bdaymonthsel['8']}>{$lang->month_8}</option>
<option value="9" {$bdaymonthsel['9']}>{$lang->month_9}</option>
<option value="10" {$bdaymonthsel['10']}>{$lang->month_10}</option>
<option value="11" {$bdaymonthsel['11']}>{$lang->month_11}</option>
<option value="12" {$bdaymonthsel['12']}>{$lang->month_12}</option>
</select>
</td>
<td>
<input type="text" class="textbox" size="4" maxlength="4" name="bday3" value="{$bday['2']}" />
</td>
</tr>
<tr>
<td colspan="3">
<span class="smalltext">{$lang->birthdayprivacy}</span>
</td>
</tr>
<tr>
<td colspan="3">
<select name="birthdayprivacy">
<option value="all"{$allselected}>{$lang->birthdayprivacyall}</option>
<option value="none"{$noneselected}>{$lang->birthdayprivacynone}</option>
<option value="age"{$ageselected}>{$lang->birthdayprivacyage}</option>
</select>
</td>
</tr>

Errors throw:
Please correct the following errors before continuing:

* Please choose a valid birthday privacy option.
* You need to enter a full birthday.

Does anyone know how to remove the ability to edit this? Birthday privacy does not matter for my site as it is hidden no matter what to everyone except users of the Administrator user-group.
The quick-n-dirty way (core edits - yuck!): comment out lines #226-227 of usercp.php (untested but hopefully works).

The longer, but tidier way: create a plugin hooking in to usercp_do_profile_start, and in the hook-in function, set the birthday inputs (bday1, bday2, and bday3) based on the current value of the user's birthday (in $mybb->user['bday']), so that when the user's birthday field is updated, it is not changed from what it already is. [ETA: Oh, and similarly, set the birthdayprivacy input based on the current value of the user's birthdayprivacy field (in $mybb->user['birthdayprivacy'])]
(2023-04-18, 03:26 PM)Laird Wrote: [ -> ]The quick-n-dirty way (core edits - yuck!): comment out lines #226-227 of usercp.php (untested but hopefully works).

The longer, but tidier way: create a plugin hooking in to usercp_do_profile_start, and in the hook-in function, set the birthday inputs (bday1, bday2, and bday3) based on the current value of the user's birthday (in $mybb->user['bday']), so that when the user's birthday field is updated, it is not changed from what it already is. [ETA: Oh, and similarly, set the birthdayprivacy input based on the current value of the user's birthdayprivacy field (in $mybb->user['birthdayprivacy'])]

Thanks! For temporary I'll use the core edits but I'll look into creating an actual plugin for this and releasing it to the extend section.

Appreciate the tips! Big Grin