MyBB Community Forums

Full Version: Remove birthday in UCP profile
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm modifying and changing the code for the whole forum and I removed the birthday both from profile and UCP.

The problem is even through it's removed I get an error message that says something like "Please, choose valid form of protection of you birth date." each time you confirm the update of the options - even through you didn't change anything.
 
[Image: M3Kf6wA.png]

Code of usercp_profile.php

<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->edit_options}</title>
{$headerinclude}
</head>
<body>
{$header}
<form action="usercp.php" method="post">
<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
<table width="100%" border="0" align="center">
<tr>
{$usercpnav}
<td valign="top">
{$errors}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->edit_options}</strong></td>
</tr>
<tr>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>{$lang->login_cookies_privacy}</strong></legend>
<table cellspacing="0" cellpadding="2">
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="invisible" id="invisible" value="1" {$invisiblecheck} /></td>
<td><span class="smalltext"><label for="invisible">{$lang->invisible_mode}</label></span></td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>{$lang->messaging_notification}</strong></legend>
<table cellspacing="0" cellpadding="2">
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="allownotices" id="allownotices" value="1" {$allownoticescheck} /></td>
<td><span class="smalltext"><label for="allownotices">{$lang->allow_notices}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="hideemail" id="hideemail" value="1" {$hideemailcheck} /></td>
<td><span class="smalltext"><label for="hideemail">{$lang->allow_emails}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="receivepms" id="receivepms" value="1" {$receivepmscheck} /></td>
<td><span class="smalltext"><label for="receivepms">{$lang->receive_pms}</label></span></td>
</tr>
{$pms_from_buddys}
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="pmnotice" id="pmnotice" value="1"{$pmnoticecheck} /></td>
<td><span class="smalltext"><label for="pmnotice">{$lang->pm_notice}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="pmnotify" id="pmnotify" value="1" {$pmnotifycheck} /></td>
<td><span class="smalltext"><label for="pmnotify">{$lang->pm_notify}</label></span></td>
</tr>
<tr>
<td colspan="2"><span class="smalltext"><label for="subscriptionmethod">{$lang->subscription_method}</label></span></td>
</tr>
<tr>
<td colspan="2">
    <select name="subscriptionmethod" id="subscriptionmethod">
        <option value="0" {$no_subscribe_selected}>{$lang->no_auto_subscribe}</option>
        <option value="1" {$no_email_subscribe_selected}>{$lang->no_email_subscribe}</option>
        <option value="2" {$instant_email_subscribe_selected}>{$lang->instant_email_subscribe}</option>
    </select>
</td>
</tr>

</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>{$lang->date_time_options}</strong></legend>
<table cellspacing="0" cellpadding="2">
<tr>
<td><span class="smalltext">{$lang->date_format}</span></td>
</tr>
<tr>
<td>
<select name="dateformat">
{$date_format_options}
</select>
</td>
</tr>
<tr>
<td><span class="smalltext">{$lang->time_format}</span></td>
</tr>
<tr>
<td>
<select name="timeformat">
{$time_format_options}
</select>
</td>
</tr>
<tr>
<td><span class="smalltext">{$lang->time_offset_desc}</span></td>
</tr>
<tr>
<td>{$tzselect}</td>
</tr>
<tr>
<td><span class="smalltext">{$lang->dst_correction}</span></td>
</tr>
<tr>
<td>
    <select name="dstcorrection">
        <option value="2" {$dst_auto_selected}>{$lang->dst_correction_auto}</option>
        <option value="1" {$dst_enabled_selected}>{$lang->dst_correction_enabled}</option>
        <option value="0" {$dst_disabled_selected}>{$lang->dst_correction_disabled}</option>
    </select>
</td>
</tr>
</table>
</fieldset>
</td>
<td width="50%" class="trow1" valign="top">
<fieldset class="trow2">
<legend><strong>{$lang->forum_display_options}</strong></legend>
<table cellspacing="0" cellpadding="2">
{$tppselect}
<tr>
<td><span class="smalltext">{$lang->thread_view}</span></td>
</tr>
<tr>
<td>
<select name="daysprune">
<option value="">{$lang->use_default}</option>
<option value="1" {$daysprunesel['1']}>{$lang->thread_view_lastday}</option>
<option value="5" {$daysprunesel['5']}>{$lang->thread_view_5days}</option>
<option value="10" {$daysprunesel['10']}>{$lang->thread_view_10days}</option>
<option value="20" {$daysprunesel['20']}>{$lang->thread_view_20days}</option>
<option value="50" {$daysprunesel['50']}>{$lang->thread_view_50days}</option>
<option value="75" {$daysprunesel['75']}>{$lang->thread_view_75days}</option>
<option value="100" {$daysprunesel['100']}>{$lang->thread_view_100days}</option>
<option value="365" {$daysprunesel['365']}>{$lang->thread_view_year}</option>
<option value="9999" {$daysprunesel['9999']}>{$lang->thread_view_all}</option>
</select>
</td>
</tr>
</table>
</fieldset>
<br />
<fieldset class="trow2">
<legend><strong>{$lang->thread_view_options}</strong></legend>
<table cellspacing="0" cellpadding="2">
    <tr>
    <td valign="top" width="1"><input type="checkbox" class="checkbox" name="classicpostbit" id="classicpostbit" value="1" {$classicpostbitcheck} /></td>
    <td><span class="smalltext"><label for="classicpostbit">{$lang->show_classic_postbit}</label></span></td>
    </tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="showsigs" id="showsigs" value="1" {$showsigscheck} /></td>
<td><span class="smalltext"><label for="showsigs">{$lang->show_sigs}</label></span></td>
</tr>
<tr>
<td valign="top" width="1"><input type="checkbox" class="checkbox" name="showavatars" id="showavatars" value="1" {$showavatarscheck} /></td>
<td><span class="smalltext"><label for="showavatars">{$lang->show_avatars}</label></span></td>
</tr>
<tr>

<td valign="top" width="1"><input type="checkbox" class="checkbox" name="showquickreply" id="showquickreply" value="1" {$showquickreplycheck} /></td>
<td><span class="smalltext"><label for="showquickreply">{$lang->show_quick_reply}</label></span></td>
</tr>
{$pppselect}
<tr>
<td colspan="2"><span class="smalltext">{$lang->thread_mode}</span></td>
</tr>
<tr>
<td colspan="2"><select name="threadmode"><option value="">{$lang->use_default}</option><option value="linear" {$threadview['linear']}>{$lang->linear}</option><option value="threaded" {$threadview['threaded']}>{$lang->threaded}</option></select></td>
</tr>
</table>
</fieldset>
<br />
</td>
</tr>
</table>
<br />
<div align="center">
<input type="hidden" name="action" value="do_options" />
<input type="submit" class="button" name="regsubmit" value="{$lang->update_options}" />
</div>
</td>
</tr>

</table>
</form>
{$footer}
</body>
</html>

Pretty much all I did was deleting all of the birthday-related code.

Link to forum - https://forumnew.hexcom.cz/

Theme - https://community.mybb.com/mods.php?acti...w&pid=1037
You should not delete the form fields, set the type="hidden" instead ...
Yea well I could just reverse the changes to default, it's not like I changed much in the file. Except for the birthday. But that wouldn't solve the problem though, would it?
Deleting is not the way of passing an expected input field.
Pass it like I said, you should not get any error message.
(2018-04-18, 12:07 AM)effone Wrote: [ -> ]Deleting is not the way of passing an expected input field.
Pass it like I said, you should not get any error message.

I guess I'm just too retarded to understand. How do you put the type="hidden" on those? I can see how is it done on input fields, but not on the select ones.


<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 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>
Exactly as much you have quoted in the above post; replace that part in your 'usercp_profile' template with the following:

<input type="hidden" name="bday1" />
<input type="hidden" name="bday2" />
<input type="hidden" name="bday3" value="{$bday['2']}" />
<input type="hidden" name="birthdayprivacy" value="none" />

Note, although it was optional in the above declaration; but if you have a mandatory field to fill and you need to set it hidden then set a default value as I have done above to evade error message.

Whether it is input or select; at the end of the day its all about $_POST array, so don't bother ...
Haha, it's actually working! Awesome! You're the best!