MyBB Community Forums

Full Version: make b-day require field
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello all.
just little modify if you would like to force your members to type they birhday date whene registerring
we will 2 files and one template to do this
  1. Edit member.php file
    • find
      $user['birthday'] = array(
      		"day" => $mybb->input['bday1'],
      		"month" => $mybb->input['bday2'],
      		"year" => $mybb->input['bday3']
      	);
      Add after
      $bdaysel = '';
      	for($i = 1; $i <= 31; $i++)
      	{
      		if($user['birthday'][0] == $i)
      		{
      			$bdaydaysel .= "<option value=\"$i\" selected=\"selected\">$i</option>\n";
      		}
      		else
      		{
      			$bdaydaysel .= "<option value=\"$i\">$i</option>\n";
      		}
      	}
      
    • close and save the file
  2. Edit inc/datahandlers/user.php
    • find
      $birthday['day'] = intval($birthday['day']);
      		$birthday['month'] = intval($birthday['month']);
      		$birthday['year'] = intval($birthday['year']);
      Add after
      if(!$birthday['day'] || !$birthday['month'] || !$birthday['year'])
      			{
      				$this->set_error("invalid_birthday");
      				return false;
      			}
    • close and save it
  3. replace all the code in the following attached file with your member_register template [attachment=7009]
all done now test it your self..
regards
Thanks, thats brilliant Smile
any time mate.
[offtopic]
I just remeber that I saw some members was asking for that modify, and I was have the time to done with it.. so it's only 3 steps
and mybb members deserve this little help Smile
[/offtopic]
Thank you very much for it ^^
Nice modication
Is this code compatible with mybb 1.2.9 version?
gokufg Wrote:Is this code compatible with mybb 1.2.9 version?

Yes
thanks every one for your comments,
and thanks dear Jag100 for your approval
I tried to use this in my board, but now I keep getting errors.
I did the editing in notepad. What am I doing wrong??

Thanks.
kd4fbi Wrote:I tried to use this in my board, but now I keep getting errors.
I did the editing in notepad. What am I doing wrong??

Thanks.

The "editing in notepad"; =P What's the error you're getting ? "Cannot send header information ..." ?
Pages: 1 2 3