MyBB Community Forums

Full Version: Making birthday unchangeable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can we make unchangeable the birthday field?
(Members can't change. Only admin must change it)

Thanks.
Anyone help me about this?
why not just let members do their own isnt it private
he means when the user signs up with his birthdate afterwards the user can't change it. Yahoo uses this to help there security
You can remove it from the User CP by editing the usercp_profile templates

There find and remove
<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>
zaher1988 Wrote:You can remove it from the User CP by editing the usercp_profile templates

There find and remove
<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>

That's a good idea zaher1988, thank you.
But how can I make the birthday necessary (required) on registration page when the members register?
Hello there,

Open member.php

Find
	$user['birthday'] = array(
		"day" => $mybb->input['bday1'],
		"month" => $mybb->input['bday2'],
		"year" => $mybb->input['bday3']
	);
Cut it and paste it above

$user = array(
		"username" => $mybb->input['username'],
		"password" => $mybb->input['password'],
		"password2" => $mybb->input['password2'],
		"email" => $mybb->input['email'],
		"email2" => $mybb->input['email2'],

And above both put

 if($mybb->input['bday1'] == '' || $mybb->input['bday2'] == '' || $mybb->input['bday3'] == '')
	{
		error("Please specify a birthday");
	}

Now find
$user = array(
		"username" => $mybb->input['username'],
		"password" => $mybb->input['password'],
		"password2" => $mybb->input['password2'],
		"email" => $mybb->input['email'],
		"email2" => $mybb->input['email2'],
		"usergroup" => $usergroup,
		"referrer" => $mybb->input['referrername'],
		
Below it add
"birthday" => $user['birthday'],

Now find
eval("\$registration = \"".$templates->get("member_register")."\";");

Above it add

$bdaysel = '';
	for($i = 1; $i <= 31; $i++)
	{
		if($bday[0] == $i)
		{
			$bdaydaysel .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
		}
		else
		{
			$bdaydaysel .= "<option value=\"$i\">$i</option>\n";
		}
	}
	$bdaymonthsel[$bday[1]] = "selected";

Now in the member_register

Put anywhere
<tr>
<td>
<select name="bday1">
<option value=""> </option>
{$bdaydaysel}
</select>
</td>
<td>
<select name="bday2">
<option value=""> </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>



Regards
You are great.
Thank you very much.